forked from cucumber/cucumber-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rob Holland
committed
Feb 25, 2009
1 parent
4d43a92
commit 0e12d81
Showing
7 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
$:.unshift(File.dirname(__FILE__) + '/../../lib') | ||
require 'cucumber/rake/task' | ||
|
||
Cucumber::Rake::Task.new do |t| | ||
t.cucumber_opts = "--format pretty" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'sinatra' | ||
|
||
get '/add' do | ||
erb :add | ||
end | ||
|
||
post '/add' do | ||
"Answer: #{params[:first].to_i + params[:second].to_i}" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Feature: Addition | ||
In order to avoid silly mistakes | ||
As a math idiot | ||
I want to be told the sum of two numbers | ||
|
||
Scenario: Add two numbers | ||
Given I visit the calculator page | ||
And I fill in '50' for 'first' | ||
And I fill in '70' for 'second' | ||
When I press 'Add' | ||
Then I should see 'Answer: 120' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Given /^I visit the calculator page$/ do | ||
visit '/add' | ||
end | ||
|
||
Given /^I fill in '(.*)' for '(.*)'$/ do |value, field| | ||
fill_in(field, :with => value) | ||
end | ||
|
||
When /^I press '(.*)'$/ do |name| | ||
click_button(name) | ||
end | ||
|
||
Then /^I should see '(.*)'$/ do |text| | ||
response.body.should =~ /#{text}/m | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Sinatra | ||
require File.join(File.dirname(__FILE__), *%w[.. .. app]) | ||
# Force the application name because polyglot breaks the auto-detection logic. | ||
Sinatra::Application.app_file = File.join(File.dirname(__FILE__), *%w[.. .. app.rb]) | ||
|
||
# RSpec | ||
require 'spec/expectations' | ||
|
||
# Webrat | ||
require 'webrat' | ||
Webrat.configure do |config| | ||
config.mode = :sinatra | ||
end | ||
|
||
World do | ||
include Webrat::Matchers | ||
include Webrat::HaveTagMatcher | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<form method='post' action='/add'> | ||
<input name='first'/> | ||
<input name='second'/> | ||
<input type='submit' value='Add'/> | ||
</form> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<html> | ||
<head> | ||
<title>Addition</title> | ||
</head> | ||
<body> | ||
<%= yield %> | ||
</body> | ||
</html> |