Sha256: 0c79dc7d87aea17e7a17c6efd9917c53265c3be1142826856fdccb59547bffb5

Contents?: true

Size: 1.79 KB

Versions: 3

Compression:

Stored size: 1.79 KB

Contents

require_relative '../spec_helper'

class DivGenerators
  include Fluent

  div :section, id: 'section'
end

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

  describe 'div generators' do
    context 'when declared on a page definition' do
      it 'should generate methods for referencing the div' do
        watir_definition.should respond_to(:section_object)
        watir_definition.should respond_to(:section_element)
        watir_definition.should respond_to(:section_div)
      end

      it 'should generate methods for interacting with the div' do
        watir_definition.should respond_to(:section)
        watir_definition.should respond_to(:section_exists?)
        watir_definition.should respond_to(:section_visible?)
        watir_definition.should respond_to(:section?)
        watir_definition.should respond_to(:section_?)
        watir_definition.should respond_to(:section_div_exists?)
        watir_definition.should respond_to(:section_div_visible?)
        watir_definition.should respond_to(:section_div?)
        watir_definition.should respond_to(:section_div_?)
      end
    end

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

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