0
|
1 # Ruby Snippets #
|
|
2
|
|
3 snippet class
|
|
4 abbr class
|
|
5 options head
|
|
6 class ${1:name}
|
|
7 ${2}
|
|
8 end
|
|
9
|
|
10 snippet mod
|
|
11 abbr module
|
|
12 options head
|
|
13 module ${1:name}
|
|
14 ${2}
|
|
15 end
|
|
16
|
|
17 snippet defm
|
|
18 abbr def method_missing
|
|
19 options head
|
|
20 def method_missing(method, *args, &block)
|
|
21 ${1}
|
|
22 end
|
|
23
|
|
24 snippet ea
|
|
25 abbr each do
|
|
26 options head
|
|
27 each do |${1:value}|
|
|
28 ${2}
|
|
29 end
|
|
30
|
|
31 # ActiveRecord #
|
|
32
|
|
33 snippet create_table
|
|
34 abbr create_table
|
|
35 options head
|
|
36 create_table :${1:name} do |t|
|
|
37 ${0}
|
|
38 t.timestamps
|
|
39 end
|
|
40
|
|
41 # RSpec Snippets #
|
|
42
|
|
43 snippet desc
|
|
44 abbr describe
|
|
45 options head
|
|
46 describe '${1:subject}' do
|
|
47 ${2}
|
|
48 end
|
|
49
|
|
50 snippet cont
|
|
51 abbr context
|
|
52 options head
|
|
53 context '${1:context}' do
|
|
54 ${2}
|
|
55 end
|
|
56
|
|
57 snippet bef
|
|
58 abbr before
|
|
59 options head
|
|
60 before :${1:each} do
|
|
61 ${2}
|
|
62 end
|
|
63
|
|
64 snippet aft
|
|
65 abbr after
|
|
66 options head
|
|
67 after :${:each}
|
|
68 ${2}
|
|
69 end
|
|
70
|
|
71 snippet let
|
|
72 abbr let
|
|
73 options head
|
|
74 let(:${1:object}) { ${2} }
|
|
75
|
|
76 snippet subj
|
|
77 abbr subject
|
|
78 options head
|
|
79 subject { ${1} }
|
|
80
|
|
81 snippet exp
|
|
82 abbr exp
|
|
83 options head
|
|
84 expect { ${1:expression} }.to ${2:expectance}
|
|
85
|
|
86 snippet it
|
|
87 abbr it
|
|
88 options head
|
|
89 it '${1:spec}' do
|
|
90 ${2}
|
|
91 end
|
|
92
|
|
93 snippet is
|
|
94 abbr it should
|
|
95 options head
|
|
96 it { should ${1} }
|
|
97
|
|
98 snippet isn
|
|
99 abbr it should not
|
|
100 options head
|
|
101 it { should_not ${1} }
|
|
102
|
|
103 snippet expt
|
|
104 abbr expect {}
|
|
105 options head
|
|
106 expect {
|
|
107 ${1:block}
|
|
108 }.to ${2}
|