Commit 0af73977 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'rs-fix-application-helper-specs' into 'master'

Fix ApplicationHelper specs

On current `master` if you run these specs by themselves, they fail. I have no idea why they work when run with other specs, but now they work all the time.

- Use the `helper` object, as per RSpec 3 standards
- Use `assign` to assign instance variables that helpers expect
- Add `StubConfiguration` support module

See merge request !906
parents a373422a 42b643f0
This diff is collapsed.
...@@ -13,12 +13,12 @@ RSpec.configure do |config| ...@@ -13,12 +13,12 @@ RSpec.configure do |config|
config.use_instantiated_fixtures = false config.use_instantiated_fixtures = false
config.mock_with :rspec config.mock_with :rspec
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 FactoryGirl::Syntax::Methods config.include StubConfiguration
config.include Devise::TestHelpers, type: :controller
config.include TestEnv config.include TestEnv
config.infer_spec_type_from_file_location! config.infer_spec_type_from_file_location!
config.raise_errors_for_deprecations! config.raise_errors_for_deprecations!
......
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
end
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