Sha256: 46155eb2c13f3c3d3ca2d48f7aeead2a0d97bbb3857c065242f1f03b05d9bbe8

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

# methods each pageobject should have
# set value options elements

describe Domkey::View::PageObject do

  before :all do
    goto_html("test.html")
  end

  context 'wrapping single watir elements' do

    context 'dispatcher bridges set value and options messages' do

      it 'select' do
        o = Domkey::View::PageObject.new -> { select_list(id: 'fruit_list') }
        o.set 'Tomato'
        o.value.should eql 'tomato'
      end

    end

    context 'delegate unimplmemented messages' do

      before :all do
        @o = Domkey::View::PageObject.new -> { text_field(id: 'city1') }
      end

      it 'should delegate to element when element responds' do
        @o.should respond_to(:id)
        @o.id.should eql 'city1'

        @o.should respond_to(:click)
        @o.click
      end

      it 'should not delegate to element when element does not repsond' do
        @o.should_not respond_to(:textaramabada)
        expect { @o.textaramabada }.to raise_error(NoMethodError)
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
domkey-0.4.0 spec/page_object_delegates_spec.rb