Sha256: 6ea297c310db573048bd6f7f4a5be83831e212de9004a016f519aa6c73b95b48
Contents?: true
Size: 1.01 KB
Versions: 5
Compression:
Stored size: 1.01 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
5 entries across 5 versions & 1 rubygems