rspec to capybara-webkit. simplercov now use cucumber
This commit is contained in:
parent
28ddc152e9
commit
463644c882
4 changed files with 24 additions and 40 deletions
|
@ -1,8 +1,5 @@
|
|||
# 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
|
||||
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
||||
# files.
|
||||
require 'simplecov'
|
||||
SimpleCov.start 'rails'
|
||||
|
||||
require 'cucumber/rails'
|
||||
require 'webmock/cucumber'
|
||||
|
@ -13,16 +10,12 @@ require Rails.root.join 'spec/factories'
|
|||
require Rails.root.join 'spec/support/login'
|
||||
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.javascript_driver = :webkit
|
||||
|
||||
# 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
|
||||
|
@ -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."
|
||||
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
|
||||
|
|
10
lib/tasks/dev/tests.rake
Normal file
10
lib/tasks/dev/tests.rake
Normal file
|
@ -0,0 +1,10 @@
|
|||
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
|
|||
end
|
||||
|
||||
class FakeSatellite
|
||||
def exists?
|
||||
def exists?
|
||||
true
|
||||
end
|
||||
|
||||
|
|
|
@ -17,21 +17,14 @@ require 'email_spec'
|
|||
# in spec/support/ and its subdirectories.
|
||||
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
||||
|
||||
# Use capybara-webkit
|
||||
Capybara.javascript_driver = :webkit
|
||||
|
||||
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.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
|
||||
# examples within a transaction, remove the following line or assign false
|
||||
# instead of true.
|
||||
|
@ -52,6 +45,12 @@ RSpec.configure do |config|
|
|||
DatabaseCleaner.start
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue