-
-
Save evandrix/1067624 to your computer and use it in GitHub Desktop.
Sinatra + Cucumber + Webrat
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
require 'spec/expectations' | |
require 'webrat' | |
Webrat.configure do |config| | |
config.mode = :sinatra | |
end | |
World do | |
Webrat::SinatraSession.new | |
end |
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
require 'sinatra' | |
get '/' do | |
"Hello, world!" | |
end |
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
Given /^I am viewing "(.+)"$/ do |url| | |
visit(url) | |
end | |
Then /^I should see "(.+)"$/ do |text| | |
response_body.should =~ Regexp.new(Regexp.escape(text)) | |
end |
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
Feature: view pages | |
Scenario: Home page | |
Given I am viewing "/" | |
Then I should see "Hello, world!" |
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
require 'rubygems' | |
require 'cucumber/rake/task' | |
Cucumber::Rake::Task.new(:features) do |t| | |
t.cucumber_opts = "--format pretty" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment