Sha256: db75f24aca710a59883c210b00bc8df1c35606ffa0cc2010a5b81b4d7f1762dc

Contents?: true

Size: 1.06 KB

Versions: 9

Compression:

Stored size: 1.06 KB

Contents

require_relative 'unit_helper'

describe Watir::Container do
  before { @container = Object.new.extend(Watir::Container) }

  describe '#extract_selector' do
    before do
      def @container.public_extract_selector(*args)
        extract_selector(*args)
      end
    end

    it 'converts 2-arg selector into a hash' do
      expect {
        expect(@container.public_extract_selector([:how, 'what'])).to eq Hash[how: 'what']
      }.to have_deprecated_selector_parameters
    end

    it 'returns the hash given' do
      expect(@container.public_extract_selector([how: 'what'])).to eq Hash[how: 'what']
    end

    it 'returns an empty hash if given no args' do
      expect(@container.public_extract_selector([])).to eq Hash[]
    end

    it 'raises ArgumentError if given 1 arg which is not a Hash' do
      expect { @container.public_extract_selector([:how]) }.to raise_error(ArgumentError)
    end

    it 'raises ArgumentError if given > 2 args' do
      expect { @container.public_extract_selector([:how, 'what', 'value']) }.to raise_error(ArgumentError)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
watir-6.16.5 spec/unit/container_spec.rb
watir-6.16.4 spec/unit/container_spec.rb
watir-6.16.3 spec/unit/container_spec.rb
watir-6.16.2 spec/unit/container_spec.rb
watir-6.16.1 spec/unit/container_spec.rb
watir-6.16.0 spec/unit/container_spec.rb
watir-6.15.1 spec/unit/container_spec.rb
watir-6.15.0 spec/unit/container_spec.rb
watir-6.14.0 spec/unit/container_spec.rb