我正在尝试运行rake测试的样本应用程序,我有一个错误,我似乎无法改变。
`ERROR["test_invalid_signup_information", UsersSignupTest, 0.717775303] test_invalid_signup_information#UsersSignupTest (0.72s)ArgumentError: ArgumentError: unknown command 'v' test/integration/users_signup_test.rb:15:in `test' test/integration/users_signup_test.rb:15:in `block in <class:UsersSignupTest>' test/integration/users_signup_test.rb:15:in `test' test/integration/users_signup_test.rb:15:in `block in <class:UsersSignupTest>'
16/16: [=] 100% Time: 00:00:00, Time: 00:00:00
Finished in 0.72207s
16 tests, 34 assertions, 0 failures, 1 errors, 0 skips1它似乎指向了我粘贴在下面的users_signup页面。
`require 'test_helper'
class UsersSignupTest < ActionDispatch::IntegrationTest
test "invalid signup information" do
get signup_path
assert_no_difference 'User.count' do
post users_path, user: { name: "",
email: "user@invalid",
password: "foo",
password_confirmation: "bar" }
end
assert_template 'users/new'
test "valid signup information" do
get signup_path
name = "Example User"
email = "user@example.com"
password = "password"
assert_difference 'User.count', 1 do
post_via_redirect users_path, user: { name: name,
email: email,
password: password,
password_confirmation: password }
end
assert_template 'users/show'
end
end
end有人能看到错误吗?
发布于 2014-10-01 14:44:28
也许是因为您没有关闭第一个测试的控制流结构?有一个end不见了。
尝试使用这样的代码:
require 'test_helper'
class UsersSignupTest < ActionDispatch::IntegrationTest
test "invalid signup information" do
get signup_path
assert_no_difference 'User.count' do
post users_path, user: { name: "",
email: "user@invalid",
password: "foo",
password_confirmation: "bar" }
end
assert_template 'users/new'
end
test "valid signup information" do
get signup_path
name = "Example User"
email = "user@example.com"
password = "password"
assert_difference 'User.count', 1 do
post_via_redirect users_path, user: { name: name,
email: email,
password: password,
password_confirmation: password }
end
assert_template 'users/show'
end
endhttps://stackoverflow.com/questions/26143663
复制相似问题