Sha256: da090f8facaff8fa62b75ad7d1cbe3d723709edc5dc985f7463c36045b02a426
Contents?: true
Size: 940 Bytes
Versions: 126
Compression:
Stored size: 940 Bytes
Contents
require 'spec_helper' require 'factory_girl/syntax/blueprint' describe "a blueprint" do before do ActiveSupport::Deprecation.silenced = true define_model('User', first_name: :string, last_name: :string, email: :string) FactoryGirl.define do sequence(:email) { |n| "somebody#{n}@example.com" } end 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
126 entries across 72 versions & 6 rubygems