Skip to content

Instantly share code, notes, and snippets.

@Prevole Prevole/gemfile
Created Mar 9, 2012

Embed
What would you like to do?
Rails + Rspec + Capybara + Selenium
group :development, :test do
# RSpec
gem "rspec-rails"
gem "factory_girl_rails"
gem "database_cleaner"
gem "shoulda-matchers", :git => "https://github.com/thoughtbot/shoulda-matchers.git"
gem "capybara"
# Spork
gem "spork-rails"#, "> 0.9.0.rc"
# Yard documentation
gem "yard"
gem "yard-rails"
gem "rdiscount" # MarkDown dependency
# Rcov / SimpleCov
gem 'simplecov', :require => false, :group => :test
end
rspec spec/integration/registration_spec.rb
Registration
home
Should be possible to register
Should be possible to fill the register form (FAILED - 1)
Failures:
1) Registration Should be possible to fill the register form
Failure/Error: find("header > p.buttons > a[data-dialogtype = 'register']").click
Errno::EADDRNOTAVAIL:
Can't assign requested address - bind(2)
# (eval):2:in `find'
# ./spec/integration/registration_spec.rb:9:in `block (2 levels) in <top (required)>'
Finished in 2.85 seconds
2 examples, 1 failure
Failed examples:
rspec ./spec/integration/registration_spec.rb:8 # Registration Should be possible to fill the register form
require 'spec_helper'
describe "Registration" do
it "Should be possible to register", :js => false do
visit root_url
end
# This next line will fail
it "Should be possible to fill the register form", :js => true do
find("header > p.buttons > a[data-dialogtype = 'register']").click
within "form#new_user" do
fill_in "user_pseudo", :with => "a pseudo"
end
end
end
require 'rubygems'
require 'spork'
Spork.prefork do
# Configuration for code coverage
require 'simplecov'
SimpleCov.start do
add_filter "/spec/"
add_filter "/lib/tasks"
add_filter "/config/environments"
add_filter "/config/initializers/backtrace_silencers.rb"
add_filter "/config/initializers/inflections.rb"
add_filter "/config/initializers/mime_types.rb"
add_filter "/config/initializers/secret_token.rb"
add_filter "/config/initializers/session_store.rb"
add_filter "/config/initializers/squeel_config.rb"
add_filter "/config/initializers/wrap_parameters.rb"
add_filter "/config/application.rb"
add_filter "/config/boot.rb"
add_filter "/config/boot.rb"
add_filter "/config/environment.rb"
add_filter "/config/routes.rb"
add_filter "/db/"
add_filter "/vendor/"
add_group "Controllers", "app/controllers"
add_group "Helpers", "app/helpers"
add_group "Mailers", "app/mailers"
add_group "Models", "app/models"
add_group "Validators", "app/validators"
add_group "Utils", "lib/utils"
end
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
# need to restart spork for it take effect.
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'database_cleaner'
require 'factory_girl'
require 'shoulda-matchers'
require 'capybara/rspec'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ (and its subdirectories) and spec/factories (and its subdirectories too).
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f }
RSpec.configure do |config|
config.include(MailerMacros)
# Database cleaner configuration
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.start
reset_email
end
config.after(:each) do
DatabaseCleaner.clean
end
# == Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
config.mock_with :rspec
# Factory girl configuration (enable shortcut syntax)
# config.include Factory::Syntax::Methods
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = false
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
end
end
Spork.each_run do
# This code will be run each time you run your specs.
FactoryGirl.reload
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.clean
end
rspec -b spec/integration/registration_spec.rb
No DRb server is running. Running in local process instead ...
Registration
home
Should be possible to register
Should be possible to fill the register form (FAILED - 1)
Failures:
1) Registration Should be possible to fill the register form
Failure/Error: find("header > p.buttons > a[data-dialogtype = 'register']").click
Errno::EADDRNOTAVAIL:
Can't assign requested address - bind(2)
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/firefox/socket_lock.rb:45:in `initialize'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/firefox/socket_lock.rb:45:in `new'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/firefox/socket_lock.rb:45:in `can_lock?'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/firefox/socket_lock.rb:31:in `lock'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/firefox/socket_lock.rb:17:in `locked'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/firefox/launcher.rb:32:in `launch'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/firefox/bridge.rb:19:in `initialize'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/common/driver.rb:31:in `new'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/common/driver.rb:31:in `for'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver.rb:61:in `for'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/capybara-1.1.2/lib/capybara/selenium/driver.rb:15:in `browser'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/capybara-1.1.2/lib/capybara/selenium/driver.rb:52:in `find'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/capybara-1.1.2/lib/capybara/node/finders.rb:158:in `find_in_base'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/capybara-1.1.2/lib/capybara/node/finders.rb:137:in `block in first'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/capybara-1.1.2/lib/capybara/node/finders.rb:136:in `each'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/capybara-1.1.2/lib/capybara/node/finders.rb:136:in `first'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/capybara-1.1.2/lib/capybara/node/finders.rb:27:in `block in find'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/capybara-1.1.2/lib/capybara/node/base.rb:46:in `wait_until'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/capybara-1.1.2/lib/capybara/node/finders.rb:27:in `find'
# (eval):2:in `find'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/capybara-1.1.2/lib/capybara/dsl.rb:161:in `find'
# ./spec/integration/registration_spec.rb:9:in `block (2 levels) in <top (required)>'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:80:in `instance_eval'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:80:in `block in run'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:173:in `with_around_hooks'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:77:in `run'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:355:in `block in run_examples'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:351:in `map'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:351:in `run_examples'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:337:in `run'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:28:in `map'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:28:in `block in run'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/reporter.rb:34:in `report'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:25:in `run'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:66:in `rescue in run'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:62:in `run'
# /Users/prevole/.rvm/gems/ruby-1.9.2-p290@rails31/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun'
Finished in 2.81 seconds
2 examples, 1 failure
Failed examples:
rspec ./spec/integration/registration_spec.rb:8 # Registration Should be possible to fill the register form
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.