# Commonly used webrat steps
# http://github.com/brynary/webrat

When /^I click on '(.*)'$/ do |link|
  clicks_link link
end

When /^I click the '(.*)' button$/ do |name|
  clicks_button name
end

When /^I visit the page (.+)$/ do |url|
  visit url
end




When /^I follow '(.*)'$/ do |link|
  clicks_link(link)
end

When /^I fill in '(.*)' with '(.*)'$/ do |field, value|
  fills_in(field, :with => value) 
end

When /^I select '(.*)' from '(.*)'$/ do |value, field|
  selects(value, :from => field) 
end

When /^I check '(.*)'$/ do |field|
  checks(field) 
end

When /^I uncheck '(.*)'$/ do |field|
  unchecks(field) 
end

When /^I choose '(.*)'$/ do |field|
  chooses(field)
end

When /^I attach the file at '(.*)' to '(.*)' $/ do |path, field|
  attaches_file(field, path)
end

Then /^I should see '(.*)'$/ do |text|
  response.body.should =~ /#{text}/m
end

Then /^I should not see '(.*)'$/ do |text|
  response.body.should_not =~ /#{text}/m
end

Then /^the '(.*)' checkbox should be checked$/ do |label|
  field_labeled(label).should be_checked
end
