Sha256: 1541c1c39fb6aa14effa4dbfd6b36e0d398a5f6e240a3195590805cf49a906a5

Contents?: true

Size: 1.84 KB

Versions: 3

Compression:

Stored size: 1.84 KB

Contents

require_relative '../spec_helper'

class TableGenerators
  include Fluent

  table :accounts, id: 'accounts'
end

describe Fluent::Generators do
  let(:watir_browser)    { mock_browser_for_watir }
  let(:watir_definition) { TableGenerators.new(watir_browser) }

  describe 'table generators' do
    context 'when declared on a page definition' do
      it 'should generate methods for referencing the table' do
        watir_definition.should respond_to(:accounts_object)
        watir_definition.should respond_to(:accounts_element)
        watir_definition.should respond_to(:accounts_table)
      end

      it 'should generate methods for interacting with the table' do
        watir_definition.should respond_to(:accounts)
        watir_definition.should respond_to(:accounts_exists?)
        watir_definition.should respond_to(:accounts_visible?)
        watir_definition.should respond_to(:accounts?)
        watir_definition.should respond_to(:accounts_?)
        watir_definition.should respond_to(:accounts_table_exists?)
        watir_definition.should respond_to(:accounts_table_visible?)
        watir_definition.should respond_to(:accounts_table?)
        watir_definition.should respond_to(:accounts_table_?)
      end
    end

    context 'when used by the watir platform' do
      it 'should locate the table' do
        watir_browser.should_receive(:table).and_return(watir_browser)
        web_element = watir_definition.accounts_table
        web_element.should_not be_nil
        web_element.should be_instance_of Fluent::WebElements::Table
      end

      it 'should return the text of a table' do
        watir_browser.should_receive(:table).and_return(watir_browser)
        watir_browser.should_receive(:text).and_return('testing')
        watir_definition.accounts.should == 'testing'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fluent-0.4.0 spec/generators/table_generators_spec.rb
fluent-0.3.0 spec/generators/table_generators_spec.rb
fluent-0.2.0 spec/generators/table_generators_spec.rb