Skip to content

Instantly share code, notes, and snippets.

@bruce
Created November 16, 2008 15:15
Show Gist options
  • Save bruce/25494 to your computer and use it in GitHub Desktop.
Save bruce/25494 to your computer and use it in GitHub Desktop.
require 'cucumber/rake/task'
cucumber_options = proc do |t|
t.binary = Merb.root / 'bin' / 'cucumber'
t.cucumber_opts = "--format pretty"
end
Cucumber::Rake::Task.new(:features, &cucumber_options)
Cucumber::Rake::FeatureTask.new(:feature, &cucumber_options)
namespace :merb_cucumber do
task :test_env do
Merb.start_environment(:environment => "test", :adapter => 'runner')
end
end
dependencies = ['merb_cucumber:test_env', 'db:automigrate']
task :features => dependencies
task :feature => dependencies
Feature: Login
To ensure the safety of the application
A regular user of the system
Must authenticate before using the app
Scenario: Failed Login
Given I am not authenticated
When I go to /login
And I fill in "login" with "i_dont_exist"
And I fill in "password" with "and_i_dont_have_a_password"
And I press "Log In"
Then the login request should fail
Then I should see an error message
Scenario: Passed Login
Given I am not authenticated
When I go to /login
And I fill in "login" with "bruce"
And I fill in "password" with "test"
And I press "Log In"
Then the login request should succeed
And I should not see an error message
And I should see "Welcome, Bruce Williams"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment