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
Showing
4 changed files
with
122 additions
and
9 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
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,70 @@ | |||
Feature: Detecting a field has errors on it | |||
|
|||
Scenario: A form with some fields with errors | |||
Given I have created a new Rails 3 app "enemies" with cucumber-rails support | |||
And I successfully run `rails generate scaffold enemy name:string nickname:string` | |||
And I write to "app/models/enemy.rb" with: | |||
""" | |||
class Enemy < ActiveRecord::Base | |||
validates_presence_of :name | |||
end | |||
""" | |||
And I write to "features/f.feature" with: | |||
""" | |||
Feature: Enemy form | |||
Scenario: Making an enemy | |||
Given I am on the new enemy page | |||
And I press "Create Enemy" | |||
Then the "Name" field should have the error "can't be blank" | |||
And the "Nickname" field should have no error | |||
""" | |||
When I run `bundle exec rake db:migrate` | |||
And I run `bundle exec rake cucumber` | |||
Then it should pass with: | |||
""" | |||
1 scenario (1 passed) | |||
4 steps (4 passed) | |||
""" | |||
|
|||
Scenario: A formtastic form with some fields with errors | |||
Given I have created a new Rails 3 app "enemies" with cucumber-rails support | |||
And I append to "Gemfile" with: | |||
""" | |||
gem "formtastic" | |||
""" | |||
And I successfully run `bundle` | |||
And I successfully run `rails generate scaffold enemy name:string nickname:string` | |||
And I write to "app/models/enemy.rb" with: | |||
""" | |||
class Enemy < ActiveRecord::Base | |||
validates_presence_of :name | |||
end | |||
""" | |||
And I write to "features/f.feature" with: | |||
""" | |||
Feature: Enemy form | |||
Scenario: Making an enemy | |||
Given I am on the new enemy page | |||
And I press "Create Enemy" | |||
Then the "Name" field should have the error "can't be blank" | |||
And the "Nickname" field should have no error | |||
""" | |||
And I write to "app/views/enemies/new.html.erb" with: | |||
""" | |||
<%= semantic_form_for(@enemy) do |form| %> | |||
<%= form.inputs do %> | |||
<%= form.input :name %> | |||
<%= form.input :nickname %> | |||
<% end %> | |||
<%= form.buttons do %> | |||
<%= form.commit_button %> | |||
<% end %> | |||
<% end %> | |||
""" | |||
When I run `bundle exec rake db:migrate` | |||
And I run `bundle exec rake cucumber` | |||
Then it should pass with: | |||
""" | |||
1 scenario (1 passed) | |||
4 steps (4 passed) | |||
""" |
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