Ruby on rails rspec不知从何而来的故障
如果RSpec开始失败,则会出现以下错误: ruby 1.8.7,rails 3.06Ruby on rails rspec不知从何而来的故障,ruby-on-rails,controller,rspec,Ruby On Rails,Controller,Rspec,如果RSpec开始失败,则会出现以下错误: ruby 1.8.7,rails 3.06 ~/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby -S bundle exec rspec spec/controllers/gift_cards_controller_spec.rb:30 No DRb server is running. Running in local process instead ... Run filtered including {:line_n
~/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby -S bundle exec rspec spec/controllers/gift_cards_controller_spec.rb:30
No DRb server is running. Running in local process instead ...
Run filtered including {:line_number=>30}
F
Failures:
1) GiftCardsController POST to :create for a logged-in User with valid attributes
Failure/Error: it { should respond_with(:redirect) }
NoMethodError:
undefined method `respond_with' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0x11af4324>
# ./spec/controllers/gift_cards_controller_spec.rb:30
Finished in 0.93776 seconds
1 example, 1 failure
~/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby-S bundle exec rspec spec/controllers/gift\u cards\u controller\u spec.rb:30
没有正在运行的DRb服务器。改为在本地进程中运行。。。
运行筛选,包括{:行数=>30}
F
失败:
1) GiftCardsController发布到:为具有有效属性的登录用户创建
失败/错误:它{应该用(:重定向)响应}
命名错误:
未定义的方法“respond_with”#
#/规格/控制器/礼品卡\u控制器\u规格rb:30
以0.93776秒完成
1例,1例失败
不是应该用匹配器来回复你吗?确保它位于GEM文件中的RSpec之后:
group :development, :test do
gem 'rspec-rails', '2.4.1'
gem 'shoulda-matchers', '1.0.0.beta1'
end
将我的旧rails应用程序升级到
rails 5.0
后出现此错误。然后将以下配置添加到spec\u helper.rb
中,现在其工作正常
Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :rails
end
end