Commit 9bf6d3ab authored by Filipa Lacerda's avatar Filipa Lacerda

Adds a list of environments

parent c3db10d3
require 'spec_helper'
require 'rails_helper' require 'rails_helper'
feature 'Environments', feature: true, js:true do feature 'Environments', feature: true, js:true do
include WaitForVueResource include WaitForVueResource
given(:project) { create(:project) } let(:json) { serializer.as_json }
given(:user) { create(:user) } let(:project) { create(:empty_project, :public) }
given(:role) { :developer } 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)
project.team << [user, role] project.team << [user, role]
end end
before do
visit namespace_project_environments_path(project.namespace, project)
wait_for_vue_resource
end
describe 'when showing environments' do describe 'when showing environments' do
before do before do
visit namespace_project_environments_path(project.namespace, project) visit namespace_project_environments_path(project.namespace, project)
...@@ -36,15 +47,15 @@ feature 'Environments', feature: true, js:true do ...@@ -36,15 +47,15 @@ feature 'Environments', feature: true, js:true do
end end
context 'with environments' do context 'with environments' do
given!(:environment) { create(:environment, project: project) } let(:resource) { create_list(:environment, 2) }
scenario 'does show "Available" and "Stopped" tab with links' do scenario 'does show "Available" and "Stopped" tab with links' do
expect(page).to have_link('Stopped') expect(page).to have_link('Stopped')
expect(page).to have_link('Available') expect(page).to have_link('Available')
end end
scenario 'does show environment name' do scenario 'does show environments table' do
expect(page).to have_link(environment.name) expect(page).to have_selector('.table-holder')
end end
scenario 'does show number of available and stopped environments' do scenario 'does show number of available and stopped environments' do
...@@ -53,20 +64,13 @@ feature 'Environments', feature: true, js:true do ...@@ -53,20 +64,13 @@ feature 'Environments', feature: true, js:true do
end end
context 'without deployments' do context 'without deployments' do
before do
visit namespace_project_environments_path(project.namespace, project)
wait_for_vue_resource
end
scenario 'does show no deployments' do scenario 'does show no deployments' do
expect(page).to have_content('No deployments yet') expect(page).to have_content('No deployments yet')
end end
end end
context 'with deployments' do context 'with deployments' do
let!(:environment) { create(:environment, project: project) } # 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)
...@@ -142,11 +146,6 @@ feature 'Environments', feature: true, js:true do ...@@ -142,11 +146,6 @@ feature 'Environments', feature: true, js:true do
end end
context 'can create new environment' do context 'can create new environment' do
before do
visit namespace_project_environments_path(project.namespace, project)
wait_for_vue_resource
end
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
......
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