Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use capybara in test app, got email steps wokring

  • Loading branch information...
commit f37060a9b816d6e67c669c23f43b4008b01450b8 1 parent 1e91e45
@ianwhite authored
View
159 Gemfile.lock.development
@@ -4,95 +4,148 @@ PATH
pickle (0.4.4)
cucumber (>= 0.8)
rake
- rspec (>= 1.3)
GEM
remote: http://rubygems.org/
specs:
- actionmailer (2.3.8)
- actionpack (= 2.3.8)
- actionpack (2.3.8)
- activesupport (= 2.3.8)
- rack (~> 1.1.0)
- activerecord (2.3.8)
- activesupport (= 2.3.8)
- activeresource (2.3.8)
- activesupport (= 2.3.8)
- activesupport (2.3.8)
+ abstract (1.0.0)
+ actionmailer (3.0.5)
+ actionpack (= 3.0.5)
+ mail (~> 2.2.15)
+ actionpack (3.0.5)
+ activemodel (= 3.0.5)
+ activesupport (= 3.0.5)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.13)
+ rack-test (~> 0.5.7)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.5)
+ activesupport (= 3.0.5)
+ builder (~> 2.1.2)
+ i18n (~> 0.4)
+ activerecord (3.0.5)
+ activemodel (= 3.0.5)
+ activesupport (= 3.0.5)
+ arel (~> 2.0.2)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.5)
+ activemodel (= 3.0.5)
+ activesupport (= 3.0.5)
+ activesupport (3.0.5)
+ arel (2.0.9)
builder (2.1.2)
- capybara (0.3.9)
+ capybara (0.4.1.2)
+ celerity (>= 0.7.9)
culerity (>= 0.2.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
- selenium-webdriver (>= 0.0.3)
- cucumber (0.8.5)
- builder (~> 2.1.2)
+ selenium-webdriver (>= 0.0.27)
+ xpath (~> 0.1.3)
+ celerity (0.8.8)
+ childprocess (0.1.7)
+ ffi (~> 0.6.3)
+ cucumber (0.10.0)
+ builder (>= 2.1.2)
diff-lcs (~> 1.1.2)
- gherkin (~> 2.1.4)
- json_pure (~> 1.4.3)
- term-ansicolor (~> 1.0.4)
+ gherkin (~> 2.3.2)
+ json (~> 1.4.6)
+ term-ansicolor (~> 1.0.5)
cucumber-rails (0.3.2)
cucumber (>= 0.8.0)
- culerity (0.2.10)
- database_cleaner (0.5.2)
+ culerity (0.2.15)
+ database_cleaner (0.6.5)
diff-lcs (1.1.2)
- factory_girl (1.3.2)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ factory_girl (1.3.3)
ffi (0.6.3)
rake (>= 0.8.7)
- gherkin (2.1.5)
- trollop (~> 1.16.2)
+ gherkin (2.3.3)
+ json (~> 1.4.6)
git (1.2.5)
- json_pure (1.4.6)
+ i18n (0.5.0)
+ json (1.4.6)
+ json_pure (1.5.1)
machinist (1.0.6)
+ mail (2.2.15)
+ activesupport (>= 2.3.6)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
mime-types (1.16)
- nokogiri (1.4.3.1)
- rack (1.1.0)
- rack-test (0.5.4)
+ nokogiri (1.4.4)
+ polyglot (0.3.1)
+ rack (1.2.1)
+ rack-mount (0.6.13)
+ rack (>= 1.0.0)
+ rack-test (0.5.7)
rack (>= 1.0)
- rails (2.3.8)
- actionmailer (= 2.3.8)
- actionpack (= 2.3.8)
- activerecord (= 2.3.8)
- activeresource (= 2.3.8)
- activesupport (= 2.3.8)
- rake (>= 0.8.3)
+ rails (3.0.5)
+ actionmailer (= 3.0.5)
+ actionpack (= 3.0.5)
+ activerecord (= 3.0.5)
+ activeresource (= 3.0.5)
+ activesupport (= 3.0.5)
+ bundler (~> 1.0)
+ railties (= 3.0.5)
+ railties (3.0.5)
+ actionpack (= 3.0.5)
+ activesupport (= 3.0.5)
+ rake (>= 0.8.7)
+ thor (~> 0.14.4)
rake (0.8.7)
- rcov (0.9.8)
- rspec (1.3.0)
- rspec-rails (1.3.2)
- rack (>= 1.0.0)
- rspec (>= 1.3.0)
+ rcov (0.9.9)
+ rspec (2.5.0)
+ rspec-core (~> 2.5.0)
+ rspec-expectations (~> 2.5.0)
+ rspec-mocks (~> 2.5.0)
+ rspec-core (2.5.1)
+ rspec-expectations (2.5.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.5.0)
+ rspec-rails (2.5.0)
+ actionpack (~> 3.0)
+ activesupport (~> 3.0)
+ railties (~> 3.0)
+ rspec (~> 2.5.0)
rubyzip (0.9.4)
- selenium-webdriver (0.0.27)
- ffi (>= 0.6.1)
+ selenium-webdriver (0.1.3)
+ childprocess (~> 0.1.5)
+ ffi (~> 0.6.3)
json_pure
rubyzip
- sqlite3-ruby (1.3.1)
+ sqlite3 (1.3.3)
+ sqlite3-ruby (1.3.3)
+ sqlite3 (>= 1.3.3)
term-ansicolor (1.0.5)
- trollop (1.16.2)
- webrat (0.7.1)
- nokogiri (>= 1.2.0)
- rack (>= 1.0)
- rack-test (>= 0.5.3)
- yard (0.5.8)
+ thor (0.14.6)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.24)
+ xpath (0.1.3)
+ nokogiri (~> 1.3)
+ yard (0.6.4)
PLATFORMS
ruby
DEPENDENCIES
- bundler (>= 1.0.0)
+ bundler
capybara
cucumber-rails (>= 0.3.2)
database_cleaner
factory_girl
- git (>= 1.2.5)
+ git
machinist
pickle!
- rails (~> 2.3)
+ rack (~> 1.2.1)
+ rails (~> 3.0.5)
rcov
- rspec-rails
+ rspec-rails (~> 2.5.0)
sqlite3-ruby
- webrat
yard
View
1  Rakefile.d/cucumber.rake
@@ -18,6 +18,7 @@ namespace :cucumber do
cd "cucumber_test_app" do
sh "echo 'gem \"cucumber-rails\"' >> Gemfile"
sh "echo 'gem \"rspec-rails\"' >> Gemfile"
+ sh "echo 'gem \"capybara\"' >> Gemfile"
sh "bundle install"
end
sh "ln -s #{File.expand_path('.')} cucumber_test_app/vendor/plugins/pickle"
View
6 features/app/app.rb
@@ -106,13 +106,13 @@ class Notifier < ActionMailer::Base
def user_email(user)
@recipients = user.email
@subject = 'A user email'
- @body[:user] = user
- @body[:path] = user_path(user)
+ @user = user
+ @path = user_path(user)
end
def email(to, subject, body)
@recipients = to
@subject = subject
- @body[:body] = body
+ @body = body
end
end
View
4 features/step_definitions/extra_email_steps.rb
@@ -1,7 +1,7 @@
Given(/^an email "(.*?)" with body: "(.*?)" is delivered to (.+?)$/) do |subject, body, to|
- Notifier.deliver_email(to, subject, body)
+ Notifier.email(to, subject, body).deliver
end
Given(/^#{capture_model}'s email is delivered$/) do |model|
- Notifier.deliver_user_email(model(model))
+ Notifier.user_email(model!(model)).deliver
end
View
2  features/step_definitions/generator_steps.rb
@@ -8,7 +8,7 @@
end
Given(/^cucumber has been freshly generated$/) do
- `cd #{Rails.root}; rails g cucumber:install -f --webrat`
+ `cd #{Rails.root}; rails g cucumber:install -f --capybara`
end
Given(/^pickle path email has been freshly generated$/) do
View
2  features/step_definitions/path_steps.rb
@@ -10,5 +10,5 @@
end
Then(/^I should be at (.+)$/) do |page|
- request.path.should =~ /#{path_to(page)}/
+ current_url.should =~ /#{path_to(page)}/
end
View
17 features/support/env.rb
@@ -12,14 +12,15 @@
require 'cucumber/rails/active_record'
require 'cucumber/web/tableish'
-require 'webrat'
-require 'webrat/core/matchers'
-
-Webrat.configure do |config|
- config.mode = :rails
- config.open_error_files = false # Set to true if you want error pages to pop up in the browser
-end
-
+require 'capybara/rails'
+require 'capybara/cucumber'
+require 'capybara/session'
+require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
+# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
+# order to ease the transition to Capybara we set the default here. If you'd
+# prefer to use XPath just remove this line and adjust any selectors in your
+# steps to use the XPath syntax.
+Capybara.default_selector = :css
# If you set this to false, any error raised from within your app will bubble
# up to your step definition and out to cucumber unless you catch it somewhere
View
1  pickle.gemspec
@@ -33,6 +33,5 @@ Gem::Specification.new do |s|
s.add_development_dependency "rcov"
s.add_development_dependency "database_cleaner"
s.add_development_dependency "capybara"
- s.add_development_dependency "webrat"
s.add_development_dependency "sqlite3-ruby"
end
Please sign in to comment.
Something went wrong with that request. Please try again.