Commit 463644c8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

rspec to capybara-webkit. simplercov now use cucumber

parent 28ddc152
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. require 'simplecov'
# It is recommended to regenerate this file in the future when you upgrade to a SimpleCov.start 'rails'
# 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 'cucumber/rails' require 'cucumber/rails'
require 'webmock/cucumber' require 'webmock/cucumber'
...@@ -13,16 +10,12 @@ require Rails.root.join 'spec/factories' ...@@ -13,16 +10,12 @@ require Rails.root.join 'spec/factories'
require Rails.root.join 'spec/support/login' require Rails.root.join 'spec/support/login'
require Rails.root.join 'spec/support/valid_commit' require Rails.root.join 'spec/support/valid_commit'
# 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 Capybara.default_selector = :css
Capybara.javascript_driver = :webkit Capybara.javascript_driver = :webkit
# By default, any exception happening in your Rails application will bubble up # 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 # 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 # your application behaves in the production environment, where an error page will
# be rendered instead. # be rendered instead.
# #
# Sometimes we want to override this default behaviour and allow Rails to rescue # Sometimes we want to override this default behaviour and allow Rails to rescue
...@@ -45,22 +38,4 @@ rescue NameError ...@@ -45,22 +38,4 @@ rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it." raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end end
# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
# See the DatabaseCleaner documentation for details. Example:
#
# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
# # { :except => [:widgets] } may not do what you expect here
# # as tCucumber::Rails::Database.javascript_strategy overrides
# # this setting.
# DatabaseCleaner.strategy = :truncation
# end
#
# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
# DatabaseCleaner.strategy = :transaction
# end
#
# Possible values are :truncation and :transaction
# The :transaction strategy is faster, but might give you threading problems.
# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature
Cucumber::Rails::Database.javascript_strategy = :truncation Cucumber::Rails::Database.javascript_strategy = :truncation
namespace :dev do
desc "DEV | Run cucumber and rspec"
task :tests do
["cucumber", "rspec spec"].each do |cmd|
puts "Starting to run #{cmd}..."
system("bundle exec #{cmd}")
raise "#{cmd} failed!" unless $?.exitstatus == 0
end
end
end
...@@ -35,7 +35,7 @@ class UsersProject ...@@ -35,7 +35,7 @@ class UsersProject
end end
class FakeSatellite class FakeSatellite
def exists? def exists?
true true
end end
......
...@@ -17,21 +17,14 @@ require 'email_spec' ...@@ -17,21 +17,14 @@ require 'email_spec'
# in spec/support/ and its subdirectories. # in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
# Use capybara-webkit
Capybara.javascript_driver = :webkit
RSpec.configure do |config| RSpec.configure do |config|
# == 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 config.mock_with :rspec
config.include LoginMacros config.include LoginMacros
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your # 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 # examples within a transaction, remove the following line or assign false
# instead of true. # instead of true.
...@@ -52,6 +45,12 @@ RSpec.configure do |config| ...@@ -52,6 +45,12 @@ RSpec.configure do |config|
DatabaseCleaner.start DatabaseCleaner.start
WebMock.disable_net_connect!(allow_localhost: true) WebMock.disable_net_connect!(allow_localhost: true)
# !!! Observers disabled by default in tests
#
# Use next code to enable observers
# before(:each) { ActiveRecord::Base.observers.enable(:all) }
#
ActiveRecord::Base.observers.disable :all ActiveRecord::Base.observers.disable :all
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment