Sha256: 8e990465a3b767b7e133db59e23f8a9480ffd750b402b64d7348ad7ba9c534ff
Contents?: true
Size: 827 Bytes
Versions: 24
Compression:
Stored size: 827 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'factory_girl/syntax/sham' describe "a factory using sham syntax" do before do Sham.name { "Name" } Sham.email { "somebody#{rand(5)}@example.com" } Factory.define :user do |factory| factory.first_name { Sham.name } factory.last_name { Sham.name } factory.email { Sham.email } end end after do Factory.factories.clear Factory.sequences.clear end describe "after making an instance" do before do @instance = Factory(:user, :last_name => 'Rye') end it "should support a sham called 'name'" do @instance.first_name.should == 'Name' end it "should use the sham for the email" do @instance.email.should =~ /somebody\d@example.com/ end end end
Version data entries
24 entries across 24 versions & 13 rubygems