我正在使用 Rspec 2.14.2 为我的 Rails 4.0 应用程序编写请求规范,并且每当我尝试运行这些测试时,它们都可以正常工作,但会在命令行上吐出这个弃用警告:
DEPRECATION WARNING: ActionController::Integration is deprecated and will be removed, use ActionDispatch::Integration instead.
正如我所说,规范运行良好,我在网上找不到任何东西来解决这个弃用警告,所以我的猜测是我的规范代码有问题。我的规格文件如下
require 'spec_helper'
describe "Authenticating" do
it "should create a new authentication" do
expect {
visit "/auth/developer"
}.to change { Authentication.count }.by(1)
end
it "should create a new user" do
expect {
visit "/auth/developer"
}.to change { User.count }.by(1)
end
it "should create a new device" do
expect {
visit "/auth/developer"
}.to change { Device.count }.by(1)
Device.last.registration_id.should_not be_nil
end
describe "with an existing user and authentication" do
before do
@test_user.authentications.create(:provider => "developer", :uid => "my@email.com")
end
it "shouldn't create a new authentication" do
expect {
visit "/auth/developer"
}.not_to change { Authentication.count }.by(1)
end
it "shouldn't create a new user" do
expect {
visit "/auth/developer"
}.not_to change { Authentication.count }.by(1)
end
it "should create a new device" do
expect {
visit "/auth/developer"
}.to change { Device.count }.by(1)
@test_user.devices.last.registration_id.should_not be_nil
end
end
end
当然,弃用警告不会影响我的测试的实际功能,但是当我每次运行时它们都出现时它们会很烦人rspec spec
,我真的很想摆脱它们。
谢谢!