Skip to content

Commit ac6cd2f

Browse files
committed
cucumber now works with emails
1 parent db5abb4 commit ac6cd2f

5 files changed

Lines changed: 10 additions & 2 deletions

File tree

features/messages.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Feature: Messages
1919
And I log out
2020
When I log in as "fela"
2121
And I go to my messages page
22+
And show me the page
2223
Then I should see "Hello, fela!"
2324
And I should see "From: steve"
2425
Scenario: I should have an inbox link

features/step_definitions/common_steps.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ def hacker
22
@hacker ||= Factory(:hacker)
33
end
44
def login hacker
5+
password = hacker.password ? hacker.password : "foobar"
56
visit "/login"
67
fill_in "username", :with => hacker.username
7-
fill_in "password", :with => hacker.password
8+
fill_in "password", :with => password
89
click_button "Log in"
910
end
1011

@@ -23,7 +24,8 @@ def login hacker
2324
end
2425

2526
When /^I log in as "([^"]*)"$/ do |username|
26-
@hacker = Factory(:hacker, :username => username)
27+
@hacker = Hacker.first(:username => username)
28+
@hacker ||= Factory(:hacker, :username => username)
2729
login @hacker
2830
end
2931

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Given /^I send a message to "([^"]*)" that says "([^"]*)"$/ do |recipient, body|
2+
Factory(:hacker, :username => recipient)
23
Factory(:message, :recipient => recipient, :body => body)
34
end
45

features/support/env.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
require 'capybara'
88
require 'capybara/cucumber'
99
require 'spec'
10+
require 'spec/stubs/cucumber'
1011
require 'database_cleaner'
1112
require 'database_cleaner/cucumber'
1213
DatabaseCleaner.strategy = :truncation
@@ -22,6 +23,8 @@
2223
include Spec::Matchers
2324
end
2425

26+
Pony.stub(:deliver)
27+
2528
require 'factory_girl'
2629
Dir.glob(File.join(File.dirname(__FILE__), '..', '..', '/factories/*.rb')).each do |factory|
2730
require factory

models/hacker.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class Hacker
66

77
#we're storing a unique username
88
key :username, String, :unique => true
9+
910
#and a unique email
1011
key :email, String, :unique => true
1112

0 commit comments

Comments
 (0)