Sha256: 7a47c00aea178f593466a01524c135704df3dd9940d729484dfbb8925b436a10

Contents?: true

Size: 1.82 KB

Versions: 3

Compression:

Stored size: 1.82 KB

Contents

require_relative '../spec_helper'

class CellGenerators
  include Fluent

  cell :total, id: 'total'
end

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

  describe 'cell generators' do
    context 'when declared on a page definition' do
      it 'should generate methods for referencing the cell' do
        watir_definition.should respond_to(:total_object)
        watir_definition.should respond_to(:total_element)
        watir_definition.should respond_to(:total_cell)
        watir_definition.should respond_to(:total_td)
      end

      it 'should generate methods for interacting with the cell' do
        watir_definition.should respond_to(:total)
        watir_definition.should respond_to(:total_exists?)
        watir_definition.should respond_to(:total_visible?)
        watir_definition.should respond_to(:total?)
        watir_definition.should respond_to(:total_?)
        watir_definition.should respond_to(:total_td_exists?)
        watir_definition.should respond_to(:total_td_visible?)
        watir_definition.should respond_to(:total_td?)
        watir_definition.should respond_to(:total_td_?)
      end
    end

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

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