Permalink
Browse files

Fixed some of the broken features on

the that had not been converted to using
proper capybara syntax.  Partially closes
#206.
  • Loading branch information...
1 parent 9036e79 commit 7b10f86f3bb5d833a60c90f52cbb8544cb47c72f @mgurley mgurley committed Sep 30, 2011
Showing with 37 additions and 43 deletions.
  1. +15 −8 features/step_definitions/surveyor_steps.rb
  2. +7 −30 features/support/env.rb
  3. +1 −1 features/surveyor.feature
  4. +14 −4 testbed/Gemfile
@@ -17,7 +17,7 @@
Response.first(:conditions => hash.merge({:answer_id => answer.id})).should_not be_nil
elsif
Response.first(:conditions => hash).should_not be_nil
- end
+ end
end
end
end
@@ -34,15 +34,19 @@
end
Then /^the element "([^"]*)" should have the class "([^"]*)"$/ do |selector, css_class|
- response.should have_selector(selector, :class => css_class)
+ page.should have_selector(selector, :class => css_class)
+end
+
+Then /^the element "([^"]*)" should exist$/ do |selector|
+ page.should have_selector(selector)
end
Then /^the survey should be complete$/ do
ResponseSet.first.should be_complete
end
Then /^a dropdown should exist with the options "([^"]*)"$/ do |options_text|
- response.should have_selector('select')
+ page.should have_selector('select')
options = options_text.split(',').collect(&:strip)
within "select" do |select|
options.each do |o|
@@ -52,16 +56,15 @@
end
Then /^there should be (\d+) checkboxes$/ do |count|
- response.should have_selector('input[type=checkbox]', :count => count.to_i)
-
+ page.should have_selector('input[type=checkbox]', :count => count.to_i)
end
Then /^there should be (\d+) text areas$/ do |count|
- response.should have_selector('textarea', :count => count.to_i)
+ page.should have_selector('textarea', :count => count.to_i)
end
Then /^the question "([^"]*)" should be triggered$/ do |text|
- response.should have_selector %(fieldset[name="#{text}"][class!="q_hidden"])
+ page.should have_selector %(fieldset[name="#{text}"][class!="q_hidden"])
end
Then /^there should be (\d+) response with answer "([^"]*)"$/ do |count, answer_text|
@@ -79,5 +82,9 @@
end
Then /^I should see the image "([^"]*)"$/ do |src|
- response.should have_selector %(img[src^="#{src}"])
+ page.should have_selector %(img[src^="#{src}"])
+end
+
+Then /^(\d+) responses should exist$/ do |response_count|
+ Response.count.should == response_count.to_i
end
@@ -1,43 +1,20 @@
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
-# It is recommended to regenerate this file in the future when you upgrade to a
-# newer version of cucumber-rails. Consider adding your own code to a new file
+# It is recommended to regenerate this file in the future when you upgrade to a
+# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
-
-require 'rails'
-require 'cucumber/rails3/application'
-ENV["RAILS_ENV"] ||= "test"
-ENV["RAILS_ROOT"] ||= File.expand_path(File.dirname(__FILE__) + '/../..')
-require File.expand_path(File.dirname(__FILE__) + '/../../testbed/config/environment')
-require 'cucumber/rails3/action_controller'
-
-if defined?(ActiveRecord::Base)
- require 'rails/test_help'
-else
- require 'action_dispatch/testing/test_process'
- require 'action_dispatch/testing/integration'
-end
-
-if !Rails.application.config.cache_classes
- warn "WARNING: You have set Rails' config.cache_classes to false (most likely in config/environments/cucumber.rb). This setting is known to cause problems with database transactions. Set config.cache_classes to true if you want to use transactions. For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165."
-end
-
-require 'cucumber/rails/world'
-require 'cucumber/rails/hooks'
-require 'cucumber/rails/capybara'
-
-require 'cucumber/web/tableish'
-
-
+ENV["RAILS_ROOT"] ||= File.expand_path(File.dirname(__FILE__) + '/../../testbed')
+require 'cucumber/rails'
+# require File.expand_path(File.dirname(__FILE__) + '/../../testbed/config/environment.rb')
# 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
# By default, any exception happening in your Rails application will bubble up
-# to Cucumber so that your scenario will fail. This is a different from how
-# your application behaves in the production environment, where an error page will
+# to Cucumber so that your scenario will fail. This is a different from how
+# your application behaves in the production environment, where an error page will
# be rendered instead.
#
# Sometimes we want to override this default behaviour and allow Rails to rescue
@@ -149,7 +149,7 @@ Feature: Survey creation
"""
When I start the "Favorites" survey
Then I choose "other"
- And I fill in "/.*string_value.*/" with "shrimp"
+ And I fill in "r_1_string_value" with "shrimp"
And I press "Click here to finish"
Then there should be 1 response set with 1 response with:
| shrimp |
View
@@ -1,6 +1,6 @@
source 'http://rubygems.org'
-gem 'rails', '3.0.3'
+gem 'rails', '3.0.10'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
@@ -26,17 +26,27 @@ gem 'sqlite3-ruby', :require => 'sqlite3'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
+
group :development, :test do
gem 'rspec'
gem 'rspec-rails'
- gem 'capybara'
+end
+
+group :test, :ci, :cucumber do
gem 'cucumber'
gem 'cucumber-rails'
gem 'database_cleaner'
+ gem 'shoulda'
gem 'factory_girl'
+ gem 'pickle'
+ gem 'launchy'
+end
+
+group :cucumber do
+ gem 'capybara'
end
-gem 'formtastic'
+gem 'formtastic', '1.2.4'
gem 'surveyor', :path => ".."
gem 'haml'
-gem 'fastercsv'
+gem 'fastercsv'

0 comments on commit 7b10f86

Please sign in to comment.