Add method to stub current_user in component tests
We're choosing `sign_in` instead of `login_as` because IMHO component tests are more similar to controller tests than they are to system tests.
This commit is contained in:
@@ -7,7 +7,7 @@ describe MachineLearning::CommentsSummaryComponent do
|
||||
before do
|
||||
Setting["feature.machine_learning"] = true
|
||||
Setting["machine_learning.comments_summary"] = true
|
||||
allow(controller).to receive(:current_user).and_return(nil)
|
||||
sign_in(nil)
|
||||
end
|
||||
|
||||
it "is displayed when the setting is enabled" do
|
||||
|
||||
Reference in New Issue
Block a user