Commit 42b643f0 authored by Robert Speicher's avatar Robert Speicher

Fix ApplicationHelper specs

There were several specs that were failing when run by themselves.

- Use the `helper` object, as per RSpec 3 standards
- Use `assign` to assign instance variables that helpers expect
- Add `StubConfiguration` support module
parent 366799bb
This diff is collapsed.
...@@ -16,6 +16,7 @@ RSpec.configure do |config| ...@@ -16,6 +16,7 @@ RSpec.configure do |config|
config.include Devise::TestHelpers, type: :controller config.include Devise::TestHelpers, type: :controller
config.include LoginHelpers, type: :feature config.include LoginHelpers, type: :feature
config.include LoginHelpers, type: :request config.include LoginHelpers, type: :request
config.include StubConfiguration
config.include TestEnv config.include TestEnv
config.infer_spec_type_from_file_location! config.infer_spec_type_from_file_location!
......
module StubConfiguration
def stub_application_setting(messages)
allow(Gitlab::CurrentSettings.current_application_settings).
to receive_messages(messages)
end
def stub_config_setting(messages)
allow(Gitlab.config.gitlab).to receive_messages(messages)
end
def stub_gravatar_setting(messages)
allow(Gitlab.config.gravatar).to receive_messages(messages)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment