Sha256: b126e7116498aa150f9d22c296d268c0f957afeb50283e3ecec77b3cd341fee1

Contents?: true

Size: 785 Bytes

Versions: 5

Compression:

Stored size: 785 Bytes

Contents

# encoding: utf-8
require_relative 'capybara'

module LocalPac
  module SpecHelper
    module Features
      def search_for(options = {})
        url       = options.fetch(:url)
        content   = options.fetch(:content)
        client_ip = options.fetch(:client_ip, nil)
        time      = options.fetch(:time, nil)
        pac_file  = options.fetch(:pac_file, '/file.pac')

        visit(pac_file)
        within('#search') do
          fill_in 'url', :with => url
          fill_in('client_ip', :with => client_ip) if client_ip
          fill_in('time', :with => time) if time
        end
        click_on('Search')
        expect(page).to have_content(content)
      end
    end
  end
end

# encoding: utf-8
RSpec.configure do |c|
  c.include LocalPac::SpecHelper::Features
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
local_pac-0.10.2 spec/support/helper_features.rb
local_pac-0.10.1 spec/support/helper_features.rb
local_pac-0.10.0 spec/support/helper_features.rb
local_pac-0.9.0 spec/support/helper_features.rb
local_pac-0.7.0 spec/support/helper_features.rb