Codevil-beyondthebuzzwords-bdd-codebase is a project mainly written in RUBY and JAVASCRIPT, it's free.
just the basic code to support my article @ codevil
cucumber, mysql, webrat, rspec, rspec_rails, zentest
rails --database=mysql bookstore
rake db:create:all rake db:migrate
script/generate cucumber
gedit features/register_new_books.feature &
Feature: Register new books In order to make my bookstore expansible As a bookstore owner I want to be able to register new books
Scenario Outline: User register a new book successfully # features/register_new_books.feature:6
Given I am on the new book register page # features/step_definitions/webrat_steps.rb:6
Then I should see "Title" # features/step_definitions/webrat_steps.rb:93
And I should see "Author" # features/step_definitions/webrat_steps.rb:93
And I should see "Rating" # features/step_definitions/webrat_steps.rb:93
And I should see "Synopsis" # features/step_definitions/webrat_steps.rb:93
When I fill in "book[title]" with "
Examples:
| book_title | book_rating | book_synopsis | book_author |
CLUE | the god delusion | 9 | kicks gods ass | richard dawkins |
==> Can't find mapping from "the new book register page" to a path.
==> Now, go and add a mapping in /home/macskeptic/workspace/rails/bookstore/features/support/paths.rb (RuntimeError)
==> /home/macskeptic/workspace/rails/bookstore/features/support/paths.rb:22:in /^I am on (.+)$/' CLUE features/register_new_books.feature:7:in
Given I am on the new book register page'
| the antichrist | 9 | ubermesnch | friedrich nietzsche |
Can't find mapping from "the new book register page" to a path.
Now, go and add a mapping in /home/macskeptic/workspace/rails/bookstore/features/support/paths.rb (RuntimeError)
/home/macskeptic/workspace/rails/bookstore/features/support/paths.rb:22:in /^I am on (.+)$/' features/register_new_books.feature:7:in
Given I am on the new book register page'
| holy bible | 0 | sucks badly | charlatans |
Can't find mapping from "the new book register page" to a path.
Now, go and add a mapping in /home/macskeptic/workspace/rails/bookstore/features/support/paths.rb (RuntimeError)
/home/macskeptic/workspace/rails/bookstore/features/support/paths.rb:22:in /^I am on (.+)$/' features/register_new_books.feature:7:in
Given I am on the new book register page'
gedit features/support/paths.rb &
/^I am on (.+)$/' features/register_new_books.feature:7:in
Given I am on the new book register page'gedit app/controllers/books_controller.rb &
expected the following element's content to include "Title":
(Spec::Expectations::ExpectationNotMetError)
features/register_new_books.feature:8:in `Then I should see "Title"'
gedit app/controllers/books_controller.rb &
Could not find field: "book[title]" (Webrat::NotFoundError)
(eval):2:in `/^I fill in "([^"]*)" with "([^"]*)"$/'
features/register_new_books.feature:12:in `When I fill in "book[title]" with "<book_title>"'
gedit features/register_new_books.feature &
gedit features/step_definitions/book_steps.rb &
gedit app/views/books/new.html.erb &
script/generate model book title:string author:string rating:decimal synopsis:text rake db:migrate
gedit app/controllers/books_controller.rb &
gedit features/register_new_books.feature &
No action responded to create. Actions: new (ActionController::UnknownAction)
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
(eval):2:in `/^I press "([^"]*)"$/'
features/register_new_books.feature:16:in `And I press "Save"'
gedit app/controllers/books_controller.rb &
TODO (Cucumber::Pending)
features/register_new_books.feature:22:in `And the book with the title "<book_title>" should have been saved on the database'
gedit features/step_definitions/book_steps.rb &
expected nil? to return false, got true (Spec::Expectations::ExpectationNotMetError)
features/register_new_books.feature:22:in `And the book with the title "<book_title>" should have been saved on the database'
gedit app/controllers/books_controller.rb &
Feature: Register new books In order to make my bookstore expansible As a bookstore owner I want to be able to register new books
Scenario Outline: User register a new book successfully # features/register_new_books.feature:6
Given I am on the new book register page # features/step_definitions/webrat_steps.rb:6
Then I should see "Title" # features/step_definitions/webrat_steps.rb:93
And I should see "Author" # features/step_definitions/webrat_steps.rb:93
And I should see "Rating" # features/step_definitions/webrat_steps.rb:93
And I should see "Synopsis" # features/step_definitions/webrat_steps.rb:93
When I fill in "book[title]" with "
Examples:
| book_title | book_rating | book_synopsis | book_author |
| the god delusion | 9 | kicks gods ass | richard dawkins |
| the antichrist | 9 | ubermesnch | friedrich nietzsche |
| holy bible | 0 | sucks badly | charlatans |