Skip to content

Instantly share code, notes, and snippets.

@kathgironpe
Created August 2, 2011 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kathgironpe/1120456 to your computer and use it in GitHub Desktop.
Save kathgironpe/1120456 to your computer and use it in GitHub Desktop.
helpers for Steak
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