Skip to content

Commit 3963906

Browse files
Initial snippet creation.
0 parents  commit 3963906

11 files changed

+85
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# FactoryGirl Snippets for Sublime Text 2/3
2+
3+
## Included Snippets
4+
5+
`fac` -> `factory :name, :class, :parent, :aliases do ... end`
6+
7+
`seq` -> `sequence(:attribute, initial value) { |n| "#{n}" }`
8+
9+
`fgaf` -> `attributes_for(:model, attributes)`
10+
11+
`fgc` -> `create(:model, attributes)`
12+
13+
`fgcl` -> `create_list(:model, 3, attributes)`
14+
15+
`fgb` -> `build(:model, attributes)`
16+
17+
`fgbs` -> `build_stubbed(:model, attributes)`
18+
19+
`fgbl` -> `build_list(:model, 3, attributes)`
20+
21+
`after` -> `after(:create|:build|:stub) { |resource| ... }`
22+
23+
`before` -> `before(:create) { |resource| ... }`
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<snippet>
2+
<content><![CDATA[after(:${1:create}) { |${2:resource}| $0 }]]></content>
3+
<tabTrigger>after</tabTrigger>
4+
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
5+
<description>after(:create|:build|:stub) { |resource| ... }</description>
6+
</snippet>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<snippet>
2+
<content><![CDATA[attributes_for(:${1:model}${2:, ${3:attributes}})]]></content>
3+
<tabTrigger>fgc</tabTrigger>
4+
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
5+
<description>attributes_for(:model, attributes)</description>
6+
</snippet>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<snippet>
2+
<content><![CDATA[before(:create) { |${1:resource}| $0 }]]></content>
3+
<tabTrigger>before</tabTrigger>
4+
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
5+
<description>before(:create) { |resource| ... }</description>
6+
</snippet>

Snippets/build.sublime-snippet

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<snippet>
2+
<content><![CDATA[build(:${1:model}${2:, ${3:attributes}})]]></content>
3+
<tabTrigger>fgb</tabTrigger>
4+
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
5+
<description>build(:model, attributes)</description>
6+
</snippet>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<snippet>
2+
<content><![CDATA[build_list(:${1:model}, ${2:3}${3:, ${4:attributes}})]]></content>
3+
<tabTrigger>fgbl</tabTrigger>
4+
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
5+
<description>build_list(:model, 3, attributes)</description>
6+
</snippet>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<snippet>
2+
<content><![CDATA[build_stubbed(:${1:model}${2:, ${3:attributes}})]]></content>
3+
<tabTrigger>fgbs</tabTrigger>
4+
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
5+
<description>build_stubbed(:model, attributes)</description>
6+
</snippet>

Snippets/create.sublime-snippet

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<snippet>
2+
<content><![CDATA[create(:${1:model}${2:, ${3:attributes}})]]></content>
3+
<tabTrigger>fgc</tabTrigger>
4+
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
5+
<description>create(:model, attributes)</description>
6+
</snippet>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<snippet>
2+
<content><![CDATA[create_list(:${1:model}, ${2:3}${3:, ${4:attributes}})]]></content>
3+
<tabTrigger>fgbl</tabTrigger>
4+
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
5+
<description>create_list(:model, 3, attributes)</description>
6+
</snippet>

Snippets/factory.sublime-snippet

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<snippet>
2+
<content><![CDATA[factory :${1:name}${2:${3:, class: ${4:model}}${5:, parent: :${6:factory}}${7:, aliases: [:${8:alias}]}} do
3+
$0
4+
end]]></content>
5+
<tabTrigger>fac</tabTrigger>
6+
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
7+
<description>factory :name, :class, :parent, :aliases do ... end</description>
8+
</snippet>

0 commit comments

Comments
 (0)