Sha256: d818706d6d2dcac718247949870c8dadba538f6356df527dbfc58377a3ffa01a

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

Stored size: 1.26 KB

Contents

Then /^I should see a select filter for "([^"]*)"$/ do |label|
  expect(page).to have_css '.filter_select label', text: label
end

Then /^I should see a string filter for "([^"]*)"$/ do |label|
  expect(page).to have_css '.filter_string label', text: label
end

Then /^I should see a date range filter for "([^"]*)"$/ do |label|
  expect(page).to have_css '.filter_date_range label', text: label
end

Then /^I should see the following filters:$/ do |table|
  table.rows_hash.each do |label, type|
    step %{I should see a #{type} filter for "#{label}"}
  end
end

Given(/^I add parameter "([^"]*)" with value "([^"]*)" to the URL$/) do |key, value|
  url = page.current_url
  separator = url.include?('?') ? '&' : '?'
  visit url + separator + key.to_s + '=' + value.to_s
end

Then(/^I should( not)? have parameter "([^"]*)"( with value "([^"]*)")?$/) do |negative, key, compare_val, value|
  query = URI(page.current_url).query
  if query.nil?
    expect(negative).to eq true
  else
    params = Rack::Utils.parse_query query
    if compare_val
      expect(params[key]).to_not eq value if negative
      expect(params[key]).to eq value unless negative
    else
      expect(params[key]).to eq nil if negative
      expect(params[key]).to be_present unless negative
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
activeadmin-1.0.0 features/step_definitions/filter_steps.rb
activeadmin-1.0.0.pre5 features/step_definitions/filter_steps.rb
activeadmin-orac-1.0.0.pre4 features/step_definitions/filter_steps.rb
activeadmin-orac-1.0.0 features/step_definitions/filter_steps.rb
activeadmin-orac-1.0.0.pre.orac features/step_definitions/filter_steps.rb
activeadmin-1.0.0.pre4 features/step_definitions/filter_steps.rb
activeadmin-1.0.0.pre3 features/step_definitions/filter_steps.rb