Sha256: 01e643a958986914a033f2bb4790150188cb48491f232284dc2586da9e63764a

Contents?: true

Size: 692 Bytes

Versions: 17

Compression:

Stored size: 692 Bytes

Contents

class CheckIn::Input

  include RSpec::Expectations
  include RSpec::Matchers

  def initialize(label, value, within)
    @label = label
    @value = value
    @within = within || Capybara.current_session
  end

  def call
    case input.native.attribute("type")

    when "text"
      expect(input.value).to eq @value
    when "radio", "checkbox"
      case @value

      when "true", true
        expect(input).to be_selected
      when "false", false, nil
        expect(input).not_to be_selected
      end
    when "file"
      expect(page).to have_selector("[src$='#{@value}']")
    end
  end

  private

  def input
    @input ||= Pickles.find_input(@label, within: @within)
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
pickles-0.2.4 lib/cucumber/pickles/steps/check_in/input.rb
pickles-0.2.3 lib/cucumber/pickles/steps/check_in/input.rb
pickles-0.2.2 lib/cucumber/pickles/steps/check_in/input.rb
pickles-0.2.1 lib/cucumber/pickles/steps/check_in/input.rb
pickles-0.2.0 lib/cucumber/pickles/steps/check_in/input.rb
pickles-0.1.12 lib/cucumber/pickles/steps/check_in/input.rb
pickles-0.1.10 lib/cucumber/pickles/steps/check_in/input.rb
pickles-0.1.9 lib/cucumber/pickles/steps/check_in/input.rb
pickles-0.1.8 lib/cucumber/pickles/steps/check_in/input.rb
pickles-0.1.7 lib/cucumber/pickles/steps/check_in/input.rb
pickles-0.1.6 lib/cucumber/pickles/steps/check_in/input.rb
pickles-0.1.5 lib/cucumber/pickles/steps/check_in/input.rb
pickles-0.1.4 lib/cucumber/pickles/steps/check_in/input.rb
pickles-0.1.3 lib/cucumber/pickles/steps/check_in/input.rb
pickles-0.1.2 lib/cucumber/pickles/steps/check_in/input.rb
pickles-0.1.1 lib/cucumber/pickles/steps/check_in/input.rb
pickles-0.1.0 lib/cucumber/pickles/steps/check_in/input.rb