Sha256: 36935fd5cd1bb5af7c942c978e85fd03d00e595cafb5860213356af885161280

Contents?: true

Size: 1.05 KB

Versions: 8

Compression:

Stored size: 1.05 KB

Contents

require File.expand_path('watirspec/spec_helper', File.dirname(__FILE__))

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

8 entries across 8 versions & 1 rubygems

Version Path
watir-webdriver-0.7.0 spec/container_spec.rb
watir-webdriver-0.6.11 spec/container_spec.rb
watir-webdriver-0.6.10 spec/container_spec.rb
watir-webdriver-0.6.9 spec/container_spec.rb
watir-webdriver-0.6.8 spec/container_spec.rb
watir-webdriver-0.6.7 spec/container_spec.rb
watir-webdriver-0.6.6 spec/container_spec.rb
watir-webdriver-0.6.5 spec/container_spec.rb