Commit 56aaa397 authored by Filipa Lacerda's avatar Filipa Lacerda

Revert changes made on rspec tests for environment

parent 09c45429
require 'rails_helper' require 'spec_helper'
feature 'Environments', feature: true, js:true do feature 'Environments', feature: true do
include WaitForVueResource given(:project) { create(:empty_project) }
given(:user) { create(:user) }
let(:json) { serializer.as_json } given(:role) { :developer }
let(:project) { create(:empty_project, :public) }
let(:user) { create(:user) }
let(:role) { :developer }
let(:serializer) do
described_class
.new(user: user, project: project)
.represent(resource)
end
background do background do
login_as(user) login_as(user)
...@@ -20,17 +11,22 @@ feature 'Environments', feature: true, js:true do ...@@ -20,17 +11,22 @@ feature 'Environments', feature: true, js:true do
end end
describe 'when showing environments' do describe 'when showing environments' do
given!(:environment) { }
given!(:deployment) { }
given!(:manual) { }
before do before do
visit namespace_project_environments_path(project.namespace, project) visit namespace_project_environments_path(project.namespace, project)
wait_for_vue_resource
end end
context 'without environments' do context 'shows two tabs' do
scenario 'does show "Available" and "Stopped" tab with links' do scenario 'shows "Available" and "Stopped" tab with links' do
expect(page).to have_link('Available') expect(page).to have_link('Available')
expect(page).to have_link('Stopped') expect(page).to have_link('Stopped')
end end
end
context 'without environments' do
scenario 'does show no environments' do scenario 'does show no environments' do
expect(page).to have_content('You don\'t have any environments right now.') expect(page).to have_content('You don\'t have any environments right now.')
end end
...@@ -42,19 +38,10 @@ feature 'Environments', feature: true, js:true do ...@@ -42,19 +38,10 @@ feature 'Environments', feature: true, js:true do
end end
context 'with environments' do context 'with environments' do
let(:resource) { create_list(:environment, 2) } given(:environment) { create(:environment, project: project) }
before do
endpoint = namespace_project_environments_path(project.namespace, project)
stub_request(:any, endpoint).to_return(body: [{"name": "test"}])
end
scenario 'does show "Available" and "Stopped" tab with links' do
expect(page).to have_link('Stopped')
expect(page).to have_link('Available')
end
scenario 'does show environments table' do scenario 'does show environment name' do
expect(page).to have_selector('.table-holder') expect(page).to have_link(environment.name)
end end
scenario 'does show number of available and stopped environments' do scenario 'does show number of available and stopped environments' do
...@@ -69,7 +56,7 @@ feature 'Environments', feature: true, js:true do ...@@ -69,7 +56,7 @@ feature 'Environments', feature: true, js:true do
end end
context 'with deployments' do context 'with deployments' do
# TODO add environment with deployment given(:deployment) { create(:deployment, environment: environment) }
scenario 'does show deployment SHA' do scenario 'does show deployment SHA' do
expect(page).to have_link(deployment.short_sha) expect(page).to have_link(deployment.short_sha)
...@@ -144,12 +131,10 @@ feature 'Environments', feature: true, js:true do ...@@ -144,12 +131,10 @@ feature 'Environments', feature: true, js:true do
end end
end end
context 'can create new environment' do
scenario 'does have a New environment button' do scenario 'does have a New environment button' do
expect(page).to have_link('New environment') expect(page).to have_link('New environment')
end end
end end
end
describe 'when showing the environment' do describe 'when showing the environment' do
given(:environment) { create(:environment, project: project) } given(:environment) { create(:environment, project: project) }
......
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