update cucumber and capybara. one failing cuke.

This commit is contained in:
danielgrippi 2011-12-07 18:40:39 -08:00
parent f40ed9bb25
commit f4c9b548f9
7 changed files with 48 additions and 39 deletions

View file

@ -120,8 +120,8 @@ group :test, :development do
end end
group :test do group :test do
gem 'capybara', '~> 0.3.9' gem 'capybara', '~> 1.1.2'
gem 'cucumber-rails', '0.3.2' gem 'cucumber-rails', '1.2.1'
gem 'cucumber-api-steps', '0.6', :require => false gem 'cucumber-api-steps', '0.6', :require => false
gem 'database_cleaner', '0.7.0' gem 'database_cleaner', '0.7.0'
gem 'diaspora-client', :git => 'git://github.com/diaspora/diaspora-client.git' gem 'diaspora-client', :git => 'git://github.com/diaspora/diaspora-client.git'

View file

@ -100,13 +100,13 @@ GEM
capistrano-ext (1.2.1) capistrano-ext (1.2.1)
capistrano (>= 1.0.0) capistrano (>= 1.0.0)
capistrano_colors (0.5.5) capistrano_colors (0.5.5)
capybara (0.3.9) capybara (1.1.2)
culerity (>= 0.2.4)
mime-types (>= 1.16) mime-types (>= 1.16)
nokogiri (>= 1.3.3) nokogiri (>= 1.3.3)
rack (>= 1.0.0) rack (>= 1.0.0)
rack-test (>= 0.5.4) rack-test (>= 0.5.4)
selenium-webdriver (>= 0.0.3) selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
carrierwave (0.5.8) carrierwave (0.5.8)
activesupport (~> 3.0) activesupport (~> 3.0)
cgi_multipart_eof_fix (2.5.0) cgi_multipart_eof_fix (2.5.0)
@ -140,9 +140,10 @@ GEM
cucumber-api-steps (0.6) cucumber-api-steps (0.6)
cucumber (>= 0.8.3) cucumber (>= 0.8.3)
jsonpath (>= 0.1.2) jsonpath (>= 0.1.2)
cucumber-rails (0.3.2) cucumber-rails (1.2.1)
cucumber (>= 0.8.0) capybara (>= 1.1.2)
culerity (0.2.15) cucumber (>= 1.1.3)
nokogiri (>= 1.5.0)
daemons (1.1.4) daemons (1.1.4)
database_cleaner (0.7.0) database_cleaner (0.7.0)
devise (1.3.4) devise (1.3.4)
@ -418,6 +419,8 @@ GEM
addressable (>= 2.2.2) addressable (>= 2.2.2)
crack (>= 0.1.7) crack (>= 0.1.7)
will_paginate (3.0.pre2) will_paginate (3.0.pre2)
xpath (0.1.4)
nokogiri (~> 1.3)
yard (0.7.4) yard (0.7.4)
yui-compressor (0.9.6) yui-compressor (0.9.6)
POpen4 (>= 0.1.4) POpen4 (>= 0.1.4)
@ -434,13 +437,13 @@ DEPENDENCIES
capistrano (= 2.5.19) capistrano (= 2.5.19)
capistrano-ext (= 1.2.1) capistrano-ext (= 1.2.1)
capistrano_colors capistrano_colors
capybara (~> 0.3.9) capybara (~> 1.1.2)
carrierwave (= 0.5.8) carrierwave (= 0.5.8)
chef (= 0.9.12) chef (= 0.9.12)
client_side_validations client_side_validations
cloudfiles (= 1.4.10) cloudfiles (= 1.4.10)
cucumber-api-steps (= 0.6) cucumber-api-steps (= 0.6)
cucumber-rails (= 0.3.2) cucumber-rails (= 1.2.1)
database_cleaner (= 0.7.0) database_cleaner (= 0.7.0)
devise (~> 1.3.1) devise (~> 1.3.1)
devise_invitable (= 0.5.0) devise_invitable (= 0.5.0)

View file

@ -15,10 +15,10 @@ Feature: private messages
Then I should see "Greetings" within "#conversation_inbox" Then I should see "Greetings" within "#conversation_inbox"
And I should see "Greetings" within "#conversation_show" And I should see "Greetings" within "#conversation_show"
And "Alice Awesome" should be part of active conversation And "Alice Awesome" should be part of active conversation
And I should see "hello, alice!" within ".stream" And I should see "hello, alice!" within ".stream_container"
When I sign in as "alice@alice.alice" When I sign in as "alice@alice.alice"
And I reply with "hey, how you doing?" And I reply with "hey, how you doing?"
Then I should see "hey, how you doing?" within ".stream" Then I should see "hey, how you doing?" within ".stream_container"
Scenario: send an empty message Scenario: send an empty message
When I send a message with subject "Empty Greetings" and text " " to "Alice Awesome" When I send a message with subject "Empty Greetings" and text " " to "Alice Awesome"

View file

@ -39,5 +39,5 @@ Feature: editing your profile
Then I should be on my edit profile page Then I should be on my edit profile page
And I should see "Profile updated" And I should see "Profile updated"
And the "profile_date_year" field should be filled with "1986" And the "profile_date_year" field should be filled with "1986"
And the "profile_date_month" field should be filled with "November" And the "profile_date_month" field should be filled with "11"
And the "profile_date_day" field should be filled with "30" And the "profile_date_day" field should be filled with "30"

View file

@ -10,11 +10,11 @@ Then /^I should see an uploaded image within the photo drop zone$/ do
end end
Then /^I should not see an uploaded image within the photo drop zone$/ do Then /^I should not see an uploaded image within the photo drop zone$/ do
find("#photodropzone img").should be_nil all("#photodropzone img").should be_empty
end end
Then /^I should not see any posts in my stream$/ do Then /^I should not see any posts in my stream$/ do
find(".stream_element").should be_nil all(".stream_element").should be_empty
end end
Given /^"([^"]*)" has a public post with text "([^"]*)"$/ do |email, text| Given /^"([^"]*)" has a public post with text "([^"]*)"$/ do |email, text|

View file

@ -5,17 +5,12 @@
# files. # files.
ENV["RAILS_ENV"] ||= "test" ENV["RAILS_ENV"] ||= "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') unless defined?(Rails) require 'cucumber/rails'
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
require 'cucumber/rails/rspec'
require 'cucumber/rails/world'
require 'cucumber/web/tableish'
require 'capybara/rails' require 'capybara/rails'
require 'capybara/cucumber' require 'capybara/cucumber'
require 'capybara/session' require 'capybara/session'
require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript #require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
require 'cucumber/api_steps' require 'cucumber/api_steps'
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
@ -67,7 +62,8 @@ end
After do After do
AppConfig[:no_follow_diasporahq] = @no_follow_diaspora_hq_setting AppConfig[:no_follow_diasporahq] = @no_follow_diaspora_hq_setting
if Capybara.current_session.driver.respond_to?(:browser) if Capybara.current_session.driver.respond_to?(:browser)
Capybara.current_session.driver.browser.manage.delete_all_cookies Capybara.reset_sessions!
# Capybara.current_session.driver.browser.manage.delete_all_cookies
end end
end end
@ -101,20 +97,20 @@ After('@localserver') do
CapybaraSettings.instance.restore CapybaraSettings.instance.restore
end end
class Capybara::Driver::Selenium < Capybara::Driver::Base # class Capybara::Driver::Selenium < Capybara::Driver::Base
class Node < Capybara::Node # class Node < Capybara::Node
def [](name) # def [](name)
node.attribute(name.to_s) # node.attribute(name.to_s)
rescue Selenium::WebDriver::Error::WebDriverError # rescue Selenium::WebDriver::Error::WebDriverError
nil # nil
end # end
def select(option) # def select(option)
option_node = node.find_element(:xpath, ".//option[normalize-space(text())=#{Capybara::XPath.escape(option)}]") || node.find_element(:xpath, ".//option[contains(.,#{Capybara::XPath.escape(option)})]") # option_node = node.find_element(:xpath, ".//option[normalize-space(text())=#{Capybara::XPath.escape(option)}]") || node.find_element(:xpath, ".//option[contains(.,#{Capybara::XPath.escape(option)})]")
option_node.click # option_node.click
rescue # rescue
options = node.find_elements(:xpath, "//option").map { |o| "'#{o.text}'" }.join(', ') # options = node.find_elements(:xpath, "//option").map { |o| "'#{o.text}'" }.join(', ')
raise Capybara::OptionNotFound, "No such option '#{option}' in this select box. Available options: #{options}" # raise Capybara::OptionNotFound, "No such option '#{option}' in this select box. Available options: #{options}"
end # end
end # end
end # end

10
script/cucumber Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env ruby
vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
if vendored_cucumber_bin
load File.expand_path(vendored_cucumber_bin)
else
require 'rubygems' unless ENV['NO_RUBYGEMS']
require 'cucumber'
load Cucumber::BINARY
end