Created
May 9, 2011 12:49
-
-
Save pepe/962459 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
Before do | |
FontRenderer.stub!(:render_user_text).and_return(true) | |
FontRenderer.stub!(:render_tester_text).and_return(true) | |
end | |
Given /^I visit the home page$/ do | |
visit '/' | |
end | |
When /^I visit '([^']*)'$/ do |path| | |
visit path | |
end | |
Then /^I should see '([^']*)'$/ do |text| | |
page.should have_content(text) | |
end | |
Then /^I should not see '([^']*)'$/ do |text| | |
page.should_not have_content(text) | |
end | |
When /^I see '([^']*)'$/ do |text| | |
page.should have_content(text) | |
end | |
Then /^I should see '([^']*)' in '([^']*)' input$/ do |value, input| | |
page.should have_xpath("//input[contains(@value, '#{value}')][contains(@name, '#{input}')]") | |
end | |
Then /^I should see '([^']*)' in '([^']*)'$/ do |text, element| | |
page.find(:css, "#{element}").should have_content(text) | |
end | |
Then /^I fill in '(.*)' with '(.*)'$/ do |field, value| | |
fill_in(field, :with => value) | |
end | |
When /^I press '(.*)'$/ do |name| | |
click_button(name) | |
end | |
When /^I follow '(.+)'$/ do |link| | |
click_link link | |
end | |
When /^I attach file for '(.*)'$/ do |file| | |
if file == 'Encoding' | |
path = File.join(Padrino.root, "spec/fixtures/Metalista.enc") | |
elsif file == 'Opentype' | |
path = File.join(Padrino.root, "spec/fixtures/Metalista.otf") | |
elsif file != 'Pdf specimen' | |
path = File.join(Padrino.root, "spec/fixtures/test_file.png") | |
else | |
path = File.join(Padrino.root, "spec/fixtures/SCTF_Tabac.pdf") | |
end | |
attach_file(file, path) | |
end | |
Given /^I attach file '([^']*)' for '([^']*)'$/ do |path, file| | |
attach_file(file, File.join(Padrino.root, "spec/fixtures", path)) | |
end | |
When /^I attach pdf file for '(.*)'$/ do |file| | |
path = File.join(Padrino.root, "spec/fixtures/SCTF_Tabac.pdf") | |
attach_file(file, path) | |
end | |
Then /^I check '(.*)'$/ do |value| | |
check(value).should == 'checked' | |
end | |
Then /^I should see '(.*)' checked$/ do |category| | |
page.should have_css("input##{category}[checked='checked']") | |
end | |
When /^I select '([^']*)' from '(.+)'$/ do |value, field| | |
select(value, :from => field) | |
end | |
Then /^I should see '([^']*)' three times$/ do |element| | |
page.should have_css("select.#{element.downcase}", :count => 3) | |
end | |
When /^I see '([^']*)' three times$/ do |element| | |
page.should have_css("select.#{element.downcase}", :count => 3) | |
end | |
Then /^file should be '([^']*)'$/ do |mime| | |
page.response_headers["Content-Type"].should match(Regexp.new(mime)) | |
end | |
Then /^I should see title '([^']*)'$/ do |title| | |
page.find(:xpath, '/html/head/title').text.should == title | |
end | |
Given /^this scenario is pending$/ do | |
pending | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment