spec/kookaburra_spec.rb in kookaburra-0.18.3 vs spec/kookaburra_spec.rb in kookaburra-0.20.0

- old
+ new

@@ -1,50 +1,18 @@ require 'kookaburra' describe Kookaburra do describe '#given' do - context 'without a :rack_app specified' do - it 'returns an instance of the configured GivenDriver' do - my_api_driver_class = mock(Class) - my_api_driver_class.should_receive(:new) \ - .with(nil) \ - .and_return(:an_api_driver) - - my_given_driver_class = mock(Class) - my_given_driver_class.should_receive(:new) do |options| - options[:api].should == :an_api_driver - :a_given_driver - end - - k = Kookaburra.new(:given_driver_class => my_given_driver_class, - :api_driver_class => my_api_driver_class) - k.given.should == :a_given_driver + it 'returns an instance of the configured GivenDriver' do + my_given_driver_class = mock(Class) + my_given_driver_class.should_receive(:new) do |options| + options[:mental_model].should be_kind_of(Kookaburra::MentalModel) + :a_given_driver end - end - context 'with a :rack_app specified' do - it 'returns an instance of the configured GivenDriver' do - Kookaburra::RackDriver.should_receive(:new) \ - .with(:a_rack_app) \ - .and_return(:a_rack_driver) - - my_api_driver_class = mock(Class) - my_api_driver_class.should_receive(:new) \ - .with(:a_rack_driver) \ - .and_return(:an_api_driver) - - my_given_driver_class = mock(Class) - my_given_driver_class.should_receive(:new) do |options| - options[:api].should == :an_api_driver - :a_given_driver - end - - k = Kookaburra.new(:given_driver_class => my_given_driver_class, - :api_driver_class => my_api_driver_class, - :rack_app => :a_rack_app) - k.given.should == :a_given_driver - end + k = Kookaburra.new(:given_driver_class => my_given_driver_class) + k.given.should == :a_given_driver end end describe '#ui' do it 'returns an instance of the configured UIDriver' do @@ -63,11 +31,11 @@ describe '#get_data' do it 'returns a equivalent copy of the test data collection specified' do k = Kookaburra.new foos = {:spam => 'ham'} - test_data = stub(:foos => foos) - k.stub!(:test_data => test_data) + mental_model = stub(:foos => foos) + k.stub!(:mental_model => mental_model) k.get_data(:foos).should == foos end it 'does not return the same object that is the test data collection' do k = Kookaburra.new