Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 78e8778949
Fetching contributors…

Cannot retrieve contributors at this time

file 67 lines (55 sloc) 2.019 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
Then /^I should see a table header with "([^"]*)"$/ do |content|
  Then "I should see \"#{content}\" within \"th\""
end

Then /^I should not see a table header with "([^"]*)"$/ do |content|
  Then "I should not see \"#{content}\" within \"th\""
end

Then /^I should see a sortable table header with "([^"]*)"$/ do |content|
  Then "I should see \"#{content}\" within \"th.sortable\""
end

Then /^the table "([^"]*)" should have (\d+) rows/ do |selector, count|
  with_scope(selector) do
    page.all(:css, 'tr').size.should == count.to_i
  end
end

Then /^the table "([^"]*)" should have (\d+) columns/ do |selector, count|
  with_scope(selector + " tr:first") do
    page.all(:css, "td").size.should == count.to_i
  end
end

Then /^there should be (\d+) "([^"]*)" tags within "([^"]*)"$/ do |count, tag, selector|
  with_scope(selector) do
    page.all(:css, tag).size.should == count.to_i
  end
end

Then /^I should see a link to "([^"]*)"$/ do |link|
  Then "I should see \"#{link}\" within \"a\""
end

Then /^I should see a link to \/([^\/]*)\/$/ do |regexp|
  regexp = Regexp.new(regexp)
  if page.respond_to? :should
    page.should have_xpath('//a', :text => regexp)
  else
    assert page.has_xpath?('//a', :text => regexp)
  end
end

Then /^an "([^"]*)" exception should be raised when I follow "([^"]*)"$/ do |error, link|
  lambda {
    When "I follow \"#{link}\""
  }.should raise_error(error.constantize)
end

Then /^I should be in the resource section for (.+)$/ do |resource_name|
  current_url.should include(resource_name.gsub(' ', '').underscore.pluralize)
end

Then /^I should wait and see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
  sleep 1
  Then 'show me the page'
  selector ||= "*"
  locate(:xpath, "//#{selector}[text()='#{text}']")
end

Then /^I should see the page title "([^"]*)"$/ do |title|
  Then %{I should see "#{title}" within "h2#page_title"}
end

Then /^I should see a fieldset titled "([^"]*)"$/ do |title|
  Then %{I should see "#{title}" within "fieldset legend"}
end
Something went wrong with that request. Please try again.