Skip to content

Commit

Permalink
Initial snippet creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
traviskroberts committed Jan 6, 2014
0 parents commit 3963906
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# FactoryGirl Snippets for Sublime Text 2/3

## Included Snippets

`fac` -> `factory :name, :class, :parent, :aliases do ... end`

`seq` -> `sequence(:attribute, initial value) { |n| "#{n}" }`

`fgaf` -> `attributes_for(:model, attributes)`

`fgc` -> `create(:model, attributes)`

`fgcl` -> `create_list(:model, 3, attributes)`

`fgb` -> `build(:model, attributes)`

`fgbs` -> `build_stubbed(:model, attributes)`

`fgbl` -> `build_list(:model, 3, attributes)`

`after` -> `after(:create|:build|:stub) { |resource| ... }`

`before` -> `before(:create) { |resource| ... }`
6 changes: 6 additions & 0 deletions Snippets/after-callback.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<snippet>
<content><![CDATA[after(:${1:create}) { |${2:resource}| $0 }]]></content>
<tabTrigger>after</tabTrigger>
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
<description>after(:create|:build|:stub) { |resource| ... }</description>
</snippet>
6 changes: 6 additions & 0 deletions Snippets/attributes_for.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<snippet>
<content><![CDATA[attributes_for(:${1:model}${2:, ${3:attributes}})]]></content>
<tabTrigger>fgc</tabTrigger>
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
<description>attributes_for(:model, attributes)</description>
</snippet>
6 changes: 6 additions & 0 deletions Snippets/before-callback.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<snippet>
<content><![CDATA[before(:create) { |${1:resource}| $0 }]]></content>
<tabTrigger>before</tabTrigger>
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
<description>before(:create) { |resource| ... }</description>
</snippet>
6 changes: 6 additions & 0 deletions Snippets/build.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<snippet>
<content><![CDATA[build(:${1:model}${2:, ${3:attributes}})]]></content>
<tabTrigger>fgb</tabTrigger>
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
<description>build(:model, attributes)</description>
</snippet>
6 changes: 6 additions & 0 deletions Snippets/build_list.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<snippet>
<content><![CDATA[build_list(:${1:model}, ${2:3}${3:, ${4:attributes}})]]></content>
<tabTrigger>fgbl</tabTrigger>
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
<description>build_list(:model, 3, attributes)</description>
</snippet>
6 changes: 6 additions & 0 deletions Snippets/build_stubbed.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<snippet>
<content><![CDATA[build_stubbed(:${1:model}${2:, ${3:attributes}})]]></content>
<tabTrigger>fgbs</tabTrigger>
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
<description>build_stubbed(:model, attributes)</description>
</snippet>
6 changes: 6 additions & 0 deletions Snippets/create.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<snippet>
<content><![CDATA[create(:${1:model}${2:, ${3:attributes}})]]></content>
<tabTrigger>fgc</tabTrigger>
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
<description>create(:model, attributes)</description>
</snippet>
6 changes: 6 additions & 0 deletions Snippets/create_list.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<snippet>
<content><![CDATA[create_list(:${1:model}, ${2:3}${3:, ${4:attributes}})]]></content>
<tabTrigger>fgbl</tabTrigger>
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
<description>create_list(:model, 3, attributes)</description>
</snippet>
8 changes: 8 additions & 0 deletions Snippets/factory.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<snippet>
<content><![CDATA[factory :${1:name}${2:${3:, class: ${4:model}}${5:, parent: :${6:factory}}${7:, aliases: [:${8:alias}]}} do
$0
end]]></content>
<tabTrigger>fac</tabTrigger>
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
<description>factory :name, :class, :parent, :aliases do ... end</description>
</snippet>
6 changes: 6 additions & 0 deletions Snippets/sequence.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<snippet>
<content><![CDATA[sequence(:${1:attribute}${2:, initial value}) { |n| ${0:"#{n\}"} }]]></content>
<tabTrigger>seq</tabTrigger>
<scope>source.ruby, source.ruby.rails, source.ruby.rspec</scope>
<description>sequence(:attribute) { ... }</description>
</snippet>

0 comments on commit 3963906

Please sign in to comment.