Sha256: 9a219b4f66b7fe36013735878ff4c8ef7422616ec78f505c260c2296d8b2bc44

Contents?: true

Size: 1.91 KB

Versions: 11

Compression:

Stored size: 1.91 KB

Contents

require 'kookaburra'

describe Kookaburra do
  let(:configuration) {
    OpenStruct.new
  }

  let(:k) { Kookaburra.new(configuration) }

  describe '#given' do
    it 'returns an instance of the configured GivenDriver' do
      my_given_driver_class = mock(Class)
      my_given_driver_class.should_receive(:new) \
        .with(configuration) \
        .and_return(:a_given_driver)
      configuration.stub!(: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
      my_ui_driver_class = mock(Class)
      my_ui_driver_class.should_receive(:new) \
        .with(configuration) \
        .and_return(:a_ui_driver)
      configuration.stub!(:ui_driver_class => my_ui_driver_class)
      k.ui.should == :a_ui_driver
    end
  end

  describe '#get_data' do
    it 'returns a dup of the specified MentalModel::Collection' do
      collection = stub('MentalModel::Collection')
      collection.should_receive(:dup) \
        .and_return(:mental_model_collection_dup)
      configuration.stub!(:mental_model => stub(:foos => collection))
      k.get_data(:foos).should == :mental_model_collection_dup
    end
  end

  describe '.configuration' do
    it 'returns a Kookaburra::Configuration instance' do
      Kookaburra.configuration.should be_kind_of(Kookaburra::Configuration)
    end

    it 'always returns the same configuration' do
      x = Kookaburra.configuration
      y = Kookaburra.configuration
      x.app_host = 'http://example.com'
      y.app_host.should == 'http://example.com'
    end
  end

  describe '.configure' do
    it 'yields Kookaburra.configuration' do
      configuration = mock('Kookaburra::Configuration')
      configuration.should_receive(:foo=).with(:bar)
      Kookaburra.stub!(:configuration => configuration)
      Kookaburra.configure do |c|
        c.foo = :bar
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
kookaburra-1.2.0 spec/kookaburra_spec.rb
kookaburra-1.1.0 spec/kookaburra_spec.rb
kookaburra-1.0.0 spec/kookaburra_spec.rb
kookaburra-0.27.0 spec/kookaburra_spec.rb
kookaburra-0.26.1 spec/kookaburra_spec.rb
kookaburra-0.26.0 spec/kookaburra_spec.rb
kookaburra-0.25.0 spec/kookaburra_spec.rb
kookaburra-0.24.1 spec/kookaburra_spec.rb
kookaburra-0.24.0 spec/kookaburra_spec.rb
kookaburra-0.23.1 spec/kookaburra_spec.rb
kookaburra-0.23.0 spec/kookaburra_spec.rb