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