Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lots of work on Cucumber features, adding vendored version of webrat …
…(rack branch)
- Loading branch information
Showing
220 changed files
with
11,499 additions
and
67 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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
.DS_Store | ||
*.gem | ||
*.log | ||
config/database.yml | ||
config/deploy.rb | ||
config/mail.yml | ||
coverage | ||
log | ||
pkg | ||
tmp | ||
vendor | ||
tmp |
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
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
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,14 @@ | ||
Feature: Front page | ||
|
||
As a user | ||
I want to enter my information into a form | ||
In order to submit that information | ||
|
||
Scenario: User visits the front page | ||
When a user visits the front page | ||
Then they should see a form | ||
And they should see a "savings" text field | ||
And they should see an "income" text field | ||
And they should see a "bills" text field | ||
And they should see an "email" text field | ||
And they should see a submit button |
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 @@ | ||
When /^a user visits the front page$/ do | ||
visit '/' | ||
end | ||
|
||
Then /^they should see a form$/ do | ||
assert_have_selector "form[action='/new'][method='post']" | ||
end | ||
|
||
Then /^they should see a.? "([^\"]*)" text field$/ do |field| | ||
assert_have_selector "#user_#{field}" | ||
end | ||
|
||
Then /^they should see a submit button$/ do | ||
assert_have_selector "input[type=image]" | ||
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,51 @@ | ||
When /^submits a valid form with "([^\"]*)"$/ do |input| | ||
fill_all_with_valid_data | ||
values = case input | ||
when "decimals": [ "1000.00", "5000.00", "2000.00" ] | ||
when "numbers only": [ "1000", "5000", "2000" ] | ||
when "dollar signs": [ "$1000.00", "$5000.00", "$2000.00" ] | ||
end | ||
fill_in "user[savings]", :with => values.pop | ||
fill_in "user[income]", :with => values.pop | ||
fill_in "user[bills]", :with => values.pop | ||
click_button | ||
end | ||
|
||
When /^submits an invalid "([^\"]*)".*$/ do |field| | ||
fill_all_with_valid_data | ||
fill_in "user[#{field}]", :with => "invalid" | ||
click_button | ||
end | ||
|
||
When /^submits an empty "([^\"]*)".*$/ do |field| | ||
fill_all_with_valid_data | ||
fill_in "user[#{field}]", :with => "" | ||
click_button | ||
end | ||
|
||
Then /^they should see a success page$/ do | ||
assert_contain "Success!" | ||
end | ||
|
||
Then /^the "([^\"]*)" field should have an error$/ do |field| | ||
assert_have_selector "#user_#{field}" | ||
assert_have_selector ".validation" | ||
end | ||
|
||
Then /^the error should be "([^\"]*)"$/ do |error| | ||
within ".validation" do | ||
assert_contain error | ||
end | ||
end | ||
|
||
def fill_all_with_valid_data | ||
valid = { | ||
'savings' => '0', | ||
'income' => '0', | ||
'bills' => '0', | ||
'email' => 'cucumber@sumapp.com' | ||
} | ||
valid.each do |key, value| | ||
fill_in "user[#{key}]", :with => value | ||
end | ||
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,23 @@ | ||
$testing = true | ||
$root = File.expand_path(File.dirname(__FILE__) + "/../../") | ||
$:.unshift "#{$root}/lib" | ||
|
||
require 'sum' | ||
require 'rack/test' | ||
require 'test/unit' | ||
require "#{$root}/vendor/webrat/lib/webrat" | ||
|
||
Webrat.configure do |config| | ||
config.mode = :rack | ||
end | ||
|
||
World do | ||
def app | ||
Application | ||
end | ||
|
||
include Rack::Test::Methods | ||
include Test::Unit::Assertions | ||
include Webrat::Matchers | ||
include Webrat::Methods | ||
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,76 @@ | ||
Feature: Update user | ||
|
||
As a user | ||
I want to submit my information | ||
In order to see a success page | ||
|
||
Scenario: User submits a valid form with decimals | ||
When a user visits the front page | ||
And submits a valid form with "decimals" | ||
Then they should see a success page | ||
|
||
Scenario: User submits a valid form with numbers only | ||
When a user visits the front page | ||
And submits a valid form with "numbers only" | ||
Then they should see a success page | ||
|
||
Scenario: User submits a valid form with dollar signs | ||
When a user visits the front page | ||
And submits a valid form with "dollar signs" | ||
Then they should see a success page | ||
|
||
Scenario: User submits an invalid savings amount | ||
When a user visits the front page | ||
And submits an invalid "savings" amount | ||
Then they should see a form | ||
And the "savings" field should have an error | ||
And the error should be "is not a number" | ||
|
||
Scenario: User submits an empty savings amount | ||
When a user visits the front page | ||
And submits an empty "savings" amount | ||
Then they should see a form | ||
And the "savings" field should have an error | ||
And the error should be "is not a number" | ||
|
||
Scenario: User submits an invalid income amount | ||
When a user visits the front page | ||
And submits an invalid "income" amount | ||
Then they should see a form | ||
And the "income" field should have an error | ||
And the error should be "is not a number" | ||
|
||
Scenario: User submits an empty income amount | ||
When a user visits the front page | ||
And submits an empty "income" amount | ||
Then they should see a form | ||
And the "income" field should have an error | ||
And the error should be "is not a number" | ||
|
||
Scenario: User submits an invalid bills amount | ||
When a user visits the front page | ||
And submits an invalid "bills" amount | ||
Then they should see a form | ||
And the "bills" field should have an error | ||
And the error should be "is not a number" | ||
|
||
Scenario: User submits an empty bills amount | ||
When a user visits the front page | ||
And submits an empty "bills" amount | ||
Then they should see a form | ||
And the "bills" field should have an error | ||
And the error should be "is not a number" | ||
|
||
Scenario: User submits an invalid email | ||
When a user visits the front page | ||
And submits an invalid "email" | ||
Then they should see a form | ||
And the "email" field should have an error | ||
And the error should be "is invalid" | ||
|
||
Scenario: User submits an empty email | ||
When a user visits the front page | ||
And submits an empty "email" | ||
Then they should see a form | ||
And the "email" field should have an error | ||
And the error should be "can't be blank" |
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
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.