Commit d91c5bee authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'environment-specs-for-ee' into 'master'

Fix Environment terminal specs for EE

See merge request gitlab-org/gitlab-ce!23421
parents 4a6c7b27 45812f1c
...@@ -217,7 +217,10 @@ describe Projects::EnvironmentsController do ...@@ -217,7 +217,10 @@ describe Projects::EnvironmentsController do
end end
it 'loads the terminals for the environment' do it 'loads the terminals for the environment' do
expect_any_instance_of(Environment).to receive(:terminals) # In EE we have to stub EE::Environment since it overwrites the
# "terminals" method.
expect_any_instance_of(defined?(EE) ? EE::Environment : Environment)
.to receive(:terminals)
get :terminal, environment_params get :terminal, environment_params
end end
...@@ -240,7 +243,9 @@ describe Projects::EnvironmentsController do ...@@ -240,7 +243,9 @@ describe Projects::EnvironmentsController do
context 'and valid id' do context 'and valid id' do
it 'returns the first terminal for the environment' do it 'returns the first terminal for the environment' do
expect_any_instance_of(Environment) # In EE we have to stub EE::Environment since it overwrites the
# "terminals" method.
expect_any_instance_of(defined?(EE) ? EE::Environment : Environment)
.to receive(:terminals) .to receive(:terminals)
.and_return([:fake_terminal]) .and_return([:fake_terminal])
......
...@@ -165,8 +165,14 @@ describe 'Environment' do ...@@ -165,8 +165,14 @@ describe 'Environment' do
context 'web terminal', :js do context 'web terminal', :js do
before do before do
# Stub #terminals as it causes js-enabled feature specs to render the page incorrectly # Stub #terminals as it causes js-enabled feature specs to
allow_any_instance_of(Environment).to receive(:terminals) { nil } # render the page incorrectly
#
# In EE we have to stub EE::Environment since it overwrites
# the "terminals" method.
allow_any_instance_of(defined?(EE) ? EE::Environment : Environment)
.to receive(:terminals) { nil }
visit terminal_project_environment_path(project, environment) visit terminal_project_environment_path(project, environment)
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