Sha256: 135164e62b4fca1330722d542b1fab8938dd5266aa238f24c2fd59c82350e5c3

Contents?: true

Size: 511 Bytes

Versions: 9

Compression:

Stored size: 511 Bytes

Contents

class FillIN::Input

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

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

    when "radio", "checkbox"
      Pickles.select_input(input, @value)
    when "file"
      Pickles.attach_file(input, @value)
    else # password email tel ...
      input.set(@value)
    end

    input
  end

  private

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

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pickles-0.1.8 lib/cucumber/pickles/steps/fill_in/input.rb
pickles-0.1.7 lib/cucumber/pickles/steps/fill_in/input.rb
pickles-0.1.6 lib/cucumber/pickles/steps/fill_in/input.rb
pickles-0.1.5 lib/cucumber/pickles/steps/fill_in/input.rb
pickles-0.1.4 lib/cucumber/pickles/steps/fill_in/input.rb
pickles-0.1.3 lib/cucumber/pickles/steps/fill_in/input.rb
pickles-0.1.2 lib/cucumber/pickles/steps/fill_in/input.rb
pickles-0.1.1 lib/cucumber/pickles/steps/fill_in/input.rb
pickles-0.1.0 lib/cucumber/pickles/steps/fill_in/input.rb