水豚rspec更深入的测井?
在执行click_按钮后的某个时刻,我正在检索无法转储的singleton错误。rspec的所有输出告诉我:水豚rspec更深入的测井?,rspec,capybara,Rspec,Capybara,在执行click_按钮后的某个时刻,我正在检索无法转储的singleton错误。rspec的所有输出告诉我: 1) home not logged in sign in should contain content with 'Add new charity Failure/Error: click_button "Install" TypeError: singleton can't be dumped # (eval):2:in `click_button' # ./spec/
1) home not logged in sign in should contain content with 'Add new charity
Failure/Error: click_button "Install"
TypeError:
singleton can't be dumped
# (eval):2:in `click_button'
# ./spec/integration/home_spec.rb:29:in `block (4 levels) in <top (required)>'
spec_helper.rb:
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rails'
require 'capybara/dsl'
require "rack_session_access/capybara"
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
Rails.application.config do
config.middleware.use RackSessionAccess::Middleware
end
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
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/factories"
# 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 = true
# 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
# RSpec automatically cleans stuff out of backtraces;
# sometimes this is annoying when trying to debug something e.g. a gem
config.backtrace_clean_patterns = [
/\/lib\d*\/ruby\//,
/bin\//,
/gems/,
/spec\/spec_helper\.rb/,
/lib\/rspec\/(core|expectations|matchers|mocks)/
]
end
您是否考虑过使用类似Pry的工具来简化此过程?它与您的家庭规范中包含的一个文件有关 在这里您可以找到Pry: 然后,您可以在代码中插入binding.pry,您应该能够进入执行环境并检查类似irb的会话中发生了什么
否则,您需要发布您的主页_spec.rb,以便我们可以开始理论化。我确实安装了pry。我尝试一下,看看这是否能让我对正在发生的事情有更深入的了解。为了以防万一,我为spec文件和spec助手添加了代码。谢谢
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rails'
require 'capybara/dsl'
require "rack_session_access/capybara"
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
Rails.application.config do
config.middleware.use RackSessionAccess::Middleware
end
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
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/factories"
# 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 = true
# 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
# RSpec automatically cleans stuff out of backtraces;
# sometimes this is annoying when trying to debug something e.g. a gem
config.backtrace_clean_patterns = [
/\/lib\d*\/ruby\//,
/bin\//,
/gems/,
/spec\/spec_helper\.rb/,
/lib\/rspec\/(core|expectations|matchers|mocks)/
]
end