Sha256: 47ce04db090fa0443588e79e0f15590ebd12de77a59801005e67a007de3617f5

Contents?: true

Size: 1.04 KB

Versions: 11

Compression:

Stored size: 1.04 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

11 entries across 11 versions & 2 rubygems

Version Path
watir-webdriver-0.9.9 spec/container_spec.rb
watir-6.0.0.beta5 spec/container_spec.rb
watir-6.0.0.beta4 spec/container_spec.rb
watir-6.0.0.beta3 spec/container_spec.rb
watir-6.0.0.beta2 spec/container_spec.rb
watir-6.0.0.beta1 spec/container_spec.rb
watir-webdriver-0.9.3 spec/container_spec.rb
watir-webdriver-0.9.2 spec/container_spec.rb
watir-webdriver-0.9.1 spec/container_spec.rb
watir-webdriver-0.9.0 spec/container_spec.rb
watir-webdriver-0.8.0 spec/container_spec.rb