某事发生了,过去可以在master
上正常运行的旧测试不再运行
如果我运行整个规范套件(使用$ rspec
),一切都会变成绿色。
我有几个使用feature specs
的{{1}},我曾经分别调用它们来编写新的,但是如果从终端上专门调用它们,它们将不再运行:
SitePrism
这是失败的支持页面之一:
$ rspec spec/support/pages/user_log_in_page.rb
An error occurred while loading ./spec/support/pages/user_log_in_page.rb.
Failure/Error:
class UserLoginPage < SitePrism::Page
set_url "/"
def user_clicks_on_login_button
find(:xpath, "//a[@class='vr-link-footer'][text()='Login']").click
end
def user_enters_email(email)
find(:xpath, "//*[@id='user_email']").set(email)
end
NameError:
uninitialized constant SitePrism
# ./spec/support/pages/user_log_in_page.rb:3:in `<top (required)>'
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
No examples found.
Randomized with seed 4425
Finished in 0.00037 seconds (files took 0.54282 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples
我的# frozen_string_literal: true
class UserLoginPage < SitePrism::Page
set_url "/"
def user_clicks_on_login_button
find(:xpath, "//a[@class='vr-link-footer'][text()='Login']").click
end
def user_enters_email(email)
find(:xpath, "//*[@id='user_email']").set(email)
end
def user_enters_password(password)
find(:xpath, "//*[@id='user_password']").set(password)
end
def user_clicks_on_submit_button
find(:xpath, "//*[@id='vr-managed-form']/div[6]/div/input").click
end
end
拥有所需的一切,然后更多:
spec/rails-helper.rb
那会是什么?
答案 0 :(得分:0)
没关系,
$ rspec spec/support/pages/user_log_in_page.rb
永远不会运行,因为该页面应该从其他规范中调用,例如
$ rspec spec/features/user_log_in_spec.rb
(确实有效)
没什么可看的