TextMate Bundle for Factory Girl - Based from Factory Girl Snippets' on http://github.com/drnic/ruby-shoulda-tmbundle
Switch branches/tags
Nothing to show
Latest commit 87b7a34 Apr 29, 2012 @tinogomes Adjust some shortcuts
Permalink
Failed to load latest commit information.
Snippets
LICENSE
README.markdown
info.plist

README.markdown

TextMate Bundle for Factory Girl

Yay!!!!

DESCRIPTION:

The TextMate Bundle for Factory Girl - Inspiration from Factory Girl Snippets on http://github.com/drnic/ruby-shoulda-tmbundle

To use with Factory Girl, on version 1.x, use tag v1.x

INSTALATION:

with Git:

mkdir -p ~/Library/Application\ Support/TextMate/Bundles
cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/tinogomes/factory_girl-tmbundle.git FactoryGirl.tmbundle
osascript -e 'tell app "TextMate" to reload bundles'

without Git:

mkdir -p ~/Library/Application\ Support/TextMate/Bundles
cd ~/Library/Application\ Support/TextMate/Bundles
wget http://github.com/tinogomes/factory_girl-tmbundle/tarball/master
tar zxf tinogomes-factory_girl-tmbundle*.tar.gz
rm tinogomes-factory_girl-tmbundle*.tar.gz
mv tinogomes-factory_girl-tmbundle* "FactoryGirl.tmbundle"
osascript -e 'tell app "TextMate" to reload bundles'

SNIPPETS

For factories definition ( _ as cursor stop, {{ ... }} as checkpoint to edit )

  • facd<tab> - FactoryGirl define block
FactoryGirl.define do
  _
end
  • facd<tab> - FactoryGirl define block with factory
FactoryGirl.define do
  factory :{{model_name}} do
    _ # cursor stops here
  end
end
  • fac<tab> - FactoryGirl definition
factory :{{model_name}} do
  _
end
  • fac<tab> - FactoryGirl definition with aliases
factory :{{model_name}}, :aliases [:{{alias}}] do
  _
end
  • fac<tab> - FactoryGirl definition with parent
factory :{{model_name}}, :parent => :{{factory_name}} do
  _
end
  • fac<tab> - FactoryGirl definition with class
factory :{{model_name}}, :class => {{ModelName}} do
  _
end
  • facs<tab> - FactoryGirl sequence definition
FactoryGirl.sequence :{{sequence_name}} do { |n| "#{n}_" }
  • faca<tab> - FactoryGirl attribute definition
{{attribute_name}}} { _ } 
  • facas<tab> - FactoryGirl attribute association definition
association :{{attribute_association}}, :factory => {{factory_name}}_
  • facab<tab> - FactoryGirl after build callback
after_build {|{{model_name}}, evaluator| _ }
  • facac<tab> - FactoryGirl after create callback
after_create {|{{model_name}}, evaluator| _ }
  • facas<tab> - FactoryGirl after stub callback
after_stub {|{{model_name}}, evaluator| _ }
  • facg<tab> - FactoryGirl generate sequence
FactoryGirl.generate(:{{sequence_name}})_
  • facb<tab> - FactoryGirl build factory
FactoryGirl.build(:{{model}}) do
  _
end
  • facb<tab> - FactoryGirl build factory
FactoryGirl.build(:{{model_name}}) do
  _
end
  • facc<tab> - FactoryGirl create factory
FactoryGirl.create(:{{model_name}}) do
  _
end
  • facbs<tab> - FactoryGirl build stubbed factory
FactoryGirl.build_stubbed(:{{model}}) do
  _
end
  • facaf<tab> - FactoryGirl attributes for factory
FactoryGirl.attributes_for(:{{model}}) do
  _
end
  • facbl<tab> - FactoryGirl build factory in list
FactoryGirl.build_list(:{{model}}, {{count}}) do
  _
end
  • faccl<tab> - FactoryGirl create factory in list
FactoryGirl.create_list(:{{model}}, {{count}}) do
  _
end

MAINTAINERS