Sha256: 8a4444881a4399cab3bd115698084ffc7d0c957d147b6a8bb1db1573f83673e3

Contents?: true

Size: 1.86 KB

Versions: 8

Compression:

Stored size: 1.86 KB

Contents

# -*- encoding : utf-8 -*-
When /^I follow "([^\"]*)" in "([^\"]*)"$/ do |link, scope|
  within(scope) do
    click_link(link)
  end
end

Then /^I should see a stylesheet/ do
  page.should have_selector("link[rel=stylesheet]")
end

Then /^the page title should be "([^"]*)"$/i do |title|
  page.should have_selector("title", :content => title)
end

Then /I should see "(.*)" (at least|at most|exactly) (.*) times?$/i do |target, comparator, expected_num|
  actual_num = page.split(target).length - 1
  case comparator
    when "at least"
      actual_num.should >= expected_num.to_i
    when "at most"
      actual_num.should <= expected_num.to_i
    when "exactly"
      actual_num.should == expected_num.to_i
  end
end

Then /I should see a "(.*)" element with "(.*)" = "(.*)" (at least|at most|exactly) (.*) times?$/i do |target, type, selector,comparator, expected_num|
  actual_num = page.all("#{target}[#{type}=\"#{selector}\"]").length
  case comparator
    when "at least"
      actual_num.should >= expected_num.to_i
    when "at most"
      actual_num.should <= expected_num.to_i
    when "exactly"
      actual_num.should == expected_num.to_i
  end
end          

Then /^I (should not|should) see an? "([^\"]*)" element with an? "([^\"]*)" attribute of "([^\"]*)"$/ do |bool,elem,attribute,value|
  if bool == "should not"
    page.should_not have_selector("#{elem}[#{attribute}=#{value}]")
  else
    page.should have_selector("#{elem}[#{attribute}=#{value}]")
  end
end

Then /^I (should not|should) see an? "([^\"]*)" element with an? "([^\"]*)" attribute of "([^\"]*)" and an? "([^\"]*)" attribute of "([^\"]*)"$/ do |bool,elem,attribute,value,attribute2,value2|
  if bool == "should not"
    page.should_not have_selector("#{elem}[#{attribute}=#{value}][#{attribute2}=#{value2}]")
  else
    page.should have_selector("#{elem}[#{attribute}=#{value}][#{attribute2}=#{value2}]")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
blacklight-3.8.1 test_support/features/step_definitions/general_steps.rb
blacklight-3.8.0 test_support/features/step_definitions/general_steps.rb
blacklight-3.7.2 test_support/features/step_definitions/general_steps.rb
blacklight-3.7.1 test_support/features/step_definitions/general_steps.rb
blacklight-3.7.0 test_support/features/step_definitions/general_steps.rb
blacklight-3.6.1.1 test_support/features/step_definitions/general_steps.rb
blacklight-3.6.0 test_support/features/step_definitions/general_steps.rb
blacklight-3.5.0 test_support/features/step_definitions/general_steps.rb