Sha256: 5bd63ecd63196327ba941cccfe7ed61871c532494a9d50309acfcfbde728e876
Contents?: true
Size: 875 Bytes
Versions: 39
Compression:
Stored size: 875 Bytes
Contents
require 'spec_helper' require 'factory_girl/syntax/blueprint' describe "a blueprint" do before do define_model('User', :first_name => :string, :last_name => :string, :email => :string) Factory.sequence(:email) { |n| "somebody#{n}@example.com" } User.blueprint do first_name { 'Bill' } last_name { 'Nye' } email { FactoryGirl.generate(:email) } end end describe "after making an instance" do before do @instance = FactoryGirl.create(:user, :last_name => 'Rye') end it "uses attributes from the blueprint" do @instance.first_name.should == 'Bill' end it "evaluates attribute blocks for each instance" do @instance.email.should =~ /somebody\d+@example.com/ FactoryGirl.create(:user).email.should_not == @instance.email end end end
Version data entries
39 entries across 34 versions & 3 rubygems