Sha256: b1420be30df53cc51ef553e3cdfa1c81b6bb0a2bd4d864cbcfd2ebcd18f20c4d

Contents?: true

Size: 1.86 KB

Versions: 7

Compression:

Stored size: 1.86 KB

Contents

Around '@filters' do |scenario, block|
  previous_current_filters = ActiveAdmin.application.current_filters

  begin
    block.call
  ensure
    ActiveAdmin.application.current_filters = previous_current_filters
  end
end

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, value|
  query = URI(page.current_url).query
  if query.nil?
    expect(negative).to eq true
  else
    params = Rack::Utils.parse_query query
    expect(params[key]).to_not eq value if negative
    expect(params[key]).to eq value unless negative
  end
end

Then /^I should see current filter "([^"]*)" equal to "([^"]*)" with label "([^"]*)"$/ do |name, value, label|
  expect(page).to have_css "li.current_filter_#{name} span", text: label
  expect(page).to have_css "li.current_filter_#{name} b", text: value
end

Then /^I should see current filter "([^"]*)" equal to "([^"]*)"$/ do |name, value|
  expect(page).to have_css "li.current_filter_#{name} b", text: value
end

Then /^I should see link "([^"]*)" in current filters/ do |label|
  expect(page).to have_css "li.current_filter b a", text: label
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
activeadmin-rails-1.7.1 features/step_definitions/filter_steps.rb
activeadmin-rails-1.7.0 features/step_definitions/filter_steps.rb
activeadmin-rb-1.6.0 features/step_definitions/filter_steps.rb
activeadmin-rb-1.5.2 features/step_definitions/filter_steps.rb
activeadmin-rb-1.5.1 features/step_definitions/filter_steps.rb
activeadmin-rb-1.5.0 features/step_definitions/filter_steps.rb
activeadmin-rb-1.4.0 features/step_definitions/filter_steps.rb