Sha256: 650a4b83751199c439add4c65bde5b061e94da1170342e64eda5d1b51a551697
Contents?: true
Size: 1 KB
Versions: 30
Compression:
Stored size: 1 KB
Contents
class CustomFactory attr_accessor :name, :options def initialize name, options = {} @name, @options = [name, options] end end shared_examples_for 'Factory' do describe 'configure factory' do describe 'set factory' do describe 'using non-callable' do it 'should not allow factory to be defined' do lambda { subject.factory {|name, opts| CustomFactory.new name, opts} }.should raise_error end end describe 'using lambda' do before :each do subject.factory lambda {|name, opts| CustomFactory.new name, opts} end it 'should set it' do subject.factory_build('hello', :works => true).name.should == 'hello' end end describe 'using Proc' do before :each do subject.factory Proc.new {|name, opts| CustomFactory.new name, opts} end it 'should set it' do subject.factory_build('hello', :works => true).name.should == 'hello' end end end end end
Version data entries
30 entries across 30 versions & 2 rubygems