Created
August 2, 2011 15:37
-
-
Save kathgironpe/1120456 to your computer and use it in GitHub Desktop.
helpers for Steak
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
module HelperMethods | |
def log_in_with(user) | |
visit "/login" | |
fill_in "login_username", :with => user.username | |
fill_in "login_password", :with => "secret" | |
click_button "Login" | |
end | |
[:notice, :error].each do |name| | |
define_method "should_have_#{name}" do |message| | |
page.should have_css(".message.#{name}", :text => message) | |
end | |
end | |
def should_be_on(path) | |
page.current_url.should match(Regexp.new(path)) | |
end | |
def should_not_be_on(path) | |
page.current_url.should_not match(Regexp.new(path)) | |
end | |
#email-spec helpers | |
def email_should_have_body(text) | |
current_email.default_part_body.to_s.should =~ Regexp.new(text) | |
end | |
end | |
RSpec.configuration.include HelperMethods, :type => :acceptance |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment