Sha256: 9bd4f98cb7c94e5ec87288ac279e968651f80b7527711d389b950dcbd06098e2

Contents?: true

Size: 1.79 KB

Versions: 3

Compression:

Stored size: 1.79 KB

Contents

require_relative '../spec_helper'

class SpanGenerators
  include Fluent

  span :inline, id: 'inline'
end

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

  describe 'span generators' do
    context 'when declared on a page definition' do
      it 'should generate methods for referencing the span' do
        watir_definition.should respond_to(:inline_object)
        watir_definition.should respond_to(:inline_element)
        watir_definition.should respond_to(:inline_span)
      end

      it 'should generate methods for interacting with the span' do
        watir_definition.should respond_to(:inline)
        watir_definition.should respond_to(:inline_exists?)
        watir_definition.should respond_to(:inline_visible?)
        watir_definition.should respond_to(:inline?)
        watir_definition.should respond_to(:inline_?)
        watir_definition.should respond_to(:inline_span_exists?)
        watir_definition.should respond_to(:inline_span_visible?)
        watir_definition.should respond_to(:inline_span?)
        watir_definition.should respond_to(:inline_span_?)
      end
    end

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

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