Sha256: 93b81c44d96ea0b3d5694ace76409ccfcc3945daaf395b8898f07d355c5f2a61

Contents?: true

Size: 1015 Bytes

Versions: 36

Compression:

Stored size: 1015 Bytes

Contents

require 'watirspec_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(@container.public_extract_selector([:how, 'what'])).to eq Hash[how: 'what']
    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

36 entries across 36 versions & 1 rubygems

Version Path
watir-6.11.0 spec/container_spec.rb
watir-6.11.0.beta2 spec/container_spec.rb
watir-6.11.0.beta1 spec/container_spec.rb
watir-6.10.3 spec/container_spec.rb
watir-6.10.2 spec/container_spec.rb
watir-6.10.0 spec/container_spec.rb
watir-6.9.1 spec/container_spec.rb
watir-6.9.0 spec/container_spec.rb
watir-6.8.4 spec/container_spec.rb
watir-6.8.3 spec/container_spec.rb
watir-6.8.2 spec/container_spec.rb
watir-6.8.1 spec/container_spec.rb
watir-6.8.0 spec/container_spec.rb
watir-6.7.3 spec/container_spec.rb
watir-6.7.2 spec/container_spec.rb
watir-6.7.1 spec/container_spec.rb
watir-6.7.0 spec/container_spec.rb
watir-6.6.3 spec/container_spec.rb
watir-6.6.2 spec/container_spec.rb
watir-6.6.1 spec/container_spec.rb