Sha256: 8766abb078ecc086a52fe1ac208147de47c2bd672082446af4d4f5ce49ca1aec

Contents?: true

Size: 1 KB

Versions: 17

Compression:

Stored size: 1 KB

Contents

module PageMagic
  class Element
    describe Locators do
      subject(:element_clazz) do
        Class.new do
          extend(Elements)
          include(Locators)
        end
      end
      subject { element_clazz.new }

      describe '#element_by_name' do
        it 'returns the required element' do
          selector = { id: 'child' }
          element_clazz.element :child1, selector
          element_clazz.element :child2, id: 'child 2'

          expected_builder = ElementDefinitionBuilder.new(definition_class: Element, type: :element, selector: selector)

          expect(subject.element_by_name(:child1)).to eq(expected_builder)
        end

        context 'element not found' do
          it 'raises an error' do
            expected_message = (described_class::ELEMENT_NOT_DEFINED_MSG % :child)
            command = proc { subject.element_by_name(:child) }
            expect(&command).to raise_exception ElementMissingException, expected_message
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
page_magic-1.2.9 spec/page_magic/element/locators_spec.rb
page_magic-1.2.8 spec/page_magic/element/locators_spec.rb
page_magic-1.2.8.alpha spec/page_magic/element/locators_spec.rb
page_magic-1.2.7 spec/page_magic/element/locators_spec.rb
page_magic-1.2.6 spec/page_magic/element/locators_spec.rb
page_magic-1.2.5 spec/page_magic/element/locators_spec.rb
page_magic-1.2.5.alpha1 spec/page_magic/element/locators_spec.rb
page_magic-1.2.4 spec/page_magic/element/locators_spec.rb
page_magic-1.2.3 spec/page_magic/element/locators_spec.rb
page_magic-1.2.1 spec/page_magic/element/locators_spec.rb
page_magic-1.2.0 spec/page_magic/element/locators_spec.rb
page_magic-1.1.0 spec/page_magic/element/locators_spec.rb
page_magic-1.0.4 spec/page_magic/element/locators_spec.rb
page_magic-1.0.3 spec/page_magic/element/locators_spec.rb
page_magic-1.0.2 spec/page_magic/element/locators_spec.rb
page_magic-1.0.1 spec/page_magic/element/locators_spec.rb
page_magic-1.0.0 spec/page_magic/element/locators_spec.rb