diff options
Diffstat (limited to 'spec/features/projects/environments/environments_spec.rb')
-rw-r--r-- | spec/features/projects/environments/environments_spec.rb | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/spec/features/projects/environments/environments_spec.rb b/spec/features/projects/environments/environments_spec.rb index f9defa22d35..9900c13095e 100644 --- a/spec/features/projects/environments/environments_spec.rb +++ b/spec/features/projects/environments/environments_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' -feature 'Environments page', :js do - given(:project) { create(:project) } - given(:user) { create(:user) } - given(:role) { :developer } +describe 'Environments page', :js do + let(:project) { create(:project) } + let(:user) { create(:user) } + let(:role) { :developer } - background do + before do project.add_role(user, role) sign_in(user) end @@ -99,7 +99,7 @@ feature 'Environments page', :js do end describe 'environments table' do - given!(:environment) do + let!(:environment) do create(:environment, project: project, state: :available) end @@ -125,9 +125,9 @@ feature 'Environments page', :js do end context 'when there are deployments' do - given(:project) { create(:project, :repository) } + let(:project) { create(:project, :repository) } - given!(:deployment) do + let!(:deployment) do create(:deployment, environment: environment, sha: project.commit.id) end @@ -140,14 +140,14 @@ feature 'Environments page', :js do end context 'when builds and manual actions are present' do - given!(:pipeline) { create(:ci_pipeline, project: project) } - given!(:build) { create(:ci_build, pipeline: pipeline) } + let!(:pipeline) { create(:ci_pipeline, project: project) } + let!(:build) { create(:ci_build, pipeline: pipeline) } - given!(:action) do + let!(:action) do create(:ci_build, :manual, pipeline: pipeline, name: 'deploy to production') end - given!(:deployment) do + let!(:deployment) do create(:deployment, environment: environment, deployable: build, sha: project.commit.id) @@ -190,9 +190,9 @@ feature 'Environments page', :js do end context 'with external_url' do - given(:environment) { create(:environment, project: project, external_url: 'https://git.gitlab.com') } - given(:build) { create(:ci_build, pipeline: pipeline) } - given(:deployment) { create(:deployment, environment: environment, deployable: build) } + let(:environment) { create(:environment, project: project, external_url: 'https://git.gitlab.com') } + let(:build) { create(:ci_build, pipeline: pipeline) } + let(:deployment) { create(:deployment, environment: environment, deployable: build) } it 'shows an external link button' do expect(page).to have_link(nil, href: environment.external_url) @@ -200,11 +200,11 @@ feature 'Environments page', :js do end context 'with stop action' do - given(:action) do + let(:action) do create(:ci_build, :manual, pipeline: pipeline, name: 'close_app') end - given(:deployment) do + let(:deployment) do create(:deployment, environment: environment, deployable: build, on_stop: 'close_app') @@ -271,9 +271,9 @@ feature 'Environments page', :js do end context 'user is a developer' do - given(:role) { :developer } + let(:role) { :developer } - scenario 'developer creates a new environment with a valid name' do + it 'developer creates a new environment with a valid name' do within(".top-area") { click_link 'New environment' } fill_in('Name', with: 'production') click_on 'Save' @@ -281,7 +281,7 @@ feature 'Environments page', :js do expect(page).to have_content('production') end - scenario 'developer creates a new environmetn with invalid name' do + it 'developer creates a new environmetn with invalid name' do within(".top-area") { click_link 'New environment' } fill_in('Name', with: 'name,with,commas') click_on 'Save' @@ -291,9 +291,9 @@ feature 'Environments page', :js do end context 'user is a reporter' do - given(:role) { :reporter } + let(:role) { :reporter } - scenario 'reporters tries to create a new environment' do + it 'reporters tries to create a new environment' do expect(page).not_to have_link('New environment') end end @@ -309,7 +309,7 @@ feature 'Environments page', :js do state: :available) end - scenario 'users unfurls an environment folder' do + it 'users unfurls an environment folder' do visit_environments(project) expect(page).not_to have_content 'review-1' @@ -335,7 +335,7 @@ feature 'Environments page', :js do state: :available) end - scenario 'user opens folder view' do + it 'user opens folder view' do visit folder_project_environments_path(project, 'staging.review') wait_for_requests |