Sha256: 19d252fb6cfe644250406d01a7be5c1caf0d5af45fe0ec9d6906c707e6ff6af6

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

require 'kookaburra/ui_driver'
require 'support/shared_examples/it_has_a_dependency_accessor'
require 'support/shared_examples/it_can_make_assertions'

describe Kookaburra::UIDriver do
  describe '.ui_component' do
    it 'adds an accessor method for the named component that defaults to an instance of the specified class' do
      foo_component_class = mock(Class)
      foo_component_class.should_receive(:new) \
        .with(:configuration) \
        .and_return(:a_foo_component)

      ui_driver_class = Class.new(Kookaburra::UIDriver) do
        ui_component :foo, foo_component_class
      end

      ui = ui_driver_class.new(:configuration)
      ui.foo.should == :a_foo_component
    end
  end

  describe '.ui_driver' do
    it 'adds an accessor method for the named driver that defaults to an instance of the specified class' do
      foo_driver_class = mock(Class)
      foo_driver_class.should_receive(:new) \
        .with(:configuration) \
        .and_return(:a_foo_driver)

      ui_driver_class = Class.new(Kookaburra::UIDriver) do
        ui_driver :foo, foo_driver_class
      end

      ui = ui_driver_class.new(:configuration)
      ui.foo.should == :a_foo_driver
    end
  end

  it_behaves_like :it_can_make_assertions do
    let(:subject) { Kookaburra::UIDriver.new(stub('Configuration')) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kookaburra-0.22.0 spec/kookaburra/ui_driver_spec.rb