Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-04-04 16:14:15 +0300
committerFilipa Lacerda <filipa@gitlab.com>2017-04-04 16:14:15 +0300
commit5197b011a97a86b1c57cff8d8de73c30914c8c76 (patch)
tree152615892e07cba594faabeb3170d7fd86c695c2 /spec
parentd037a2e998b807d01585a48af90a3b3182eeebc5 (diff)
Fixes broken lints
Adds js unit tests
Diffstat (limited to 'spec')
-rw-r--r--spec/features/projects/environments/environments_spec.rb15
-rw-r--r--spec/features/projects/pipelines/pipelines_spec.rb18
-rw-r--r--spec/javascripts/environments/environment_actions_spec.js15
-rw-r--r--spec/javascripts/vue_pipelines_index/pipelines_actions_spec.js15
4 files changed, 30 insertions, 33 deletions
diff --git a/spec/features/projects/environments/environments_spec.rb b/spec/features/projects/environments/environments_spec.rb
index 4f78105cae1..641e2cf7402 100644
--- a/spec/features/projects/environments/environments_spec.rb
+++ b/spec/features/projects/environments/environments_spec.rb
@@ -115,21 +115,6 @@ feature 'Environments page', :feature, :js do
.not_to change { Ci::Pipeline.count }
end
- scenario 'when action is non playable', js: true do
- given(:action) do
- create(:ci_build, :manual, :non_playable,
- pipeline: pipeline,
- name: 'close_app')
- end
-
- it 'has disabled button to the manual action' do
- find('.js-dropdown-play-icon-container').click
-
- expect(page).to have_button('close_app', disabled: true)
- end
-
- end
-
scenario 'does show build name and id' do
expect(page).to have_link("#{build.name} ##{build.id}")
end
diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb
index b0f6a4235e5..2272b19bc8f 100644
--- a/spec/features/projects/pipelines/pipelines_spec.rb
+++ b/spec/features/projects/pipelines/pipelines_spec.rb
@@ -197,24 +197,6 @@ describe 'Pipelines', :feature, :js do
end
end
- context 'with non playable manual action' do
- let!(:manual) do
- create(:ci_build, :manual, :non_playable,
- pipeline: pipeline,
- name: 'manual build',
- stage: 'test',
- commands: 'test')
- end
-
- before { visit_project_pipelines }
-
- it 'has disabled button to the manual action' do
- find('.js-pipeline-dropdown-manual-actions').click
-
- expect(page).to have_button('manual build', disabled: true)
- end
- end
-
context 'for generic statuses' do
context 'when running' do
let!(:running) do
diff --git a/spec/javascripts/environments/environment_actions_spec.js b/spec/javascripts/environments/environment_actions_spec.js
index 13840b42bd6..6348d97b0a5 100644
--- a/spec/javascripts/environments/environment_actions_spec.js
+++ b/spec/javascripts/environments/environment_actions_spec.js
@@ -19,6 +19,11 @@ describe('Actions Component', () => {
name: 'foo',
play_path: '#',
},
+ {
+ name: 'foo bar',
+ play_path: 'url',
+ playable: false,
+ },
];
spy = jasmine.createSpy('spy').and.returnValue(Promise.resolve());
@@ -49,4 +54,14 @@ describe('Actions Component', () => {
expect(spy).toHaveBeenCalledWith(actionsMock[0].play_path);
});
+
+ it('should render a disabled action when it\'s not playable', () => {
+ expect(
+ component.$el.querySelector('.dropdown-menu li:last-child button').getAttribute('disabled'),
+ ).toEqual('disabled');
+
+ expect(
+ component.$el.querySelector('.dropdown-menu li:last-child button').classList.contains('disabled'),
+ ).toEqual(true);
+ });
});
diff --git a/spec/javascripts/vue_pipelines_index/pipelines_actions_spec.js b/spec/javascripts/vue_pipelines_index/pipelines_actions_spec.js
index dba998c7688..0910df61915 100644
--- a/spec/javascripts/vue_pipelines_index/pipelines_actions_spec.js
+++ b/spec/javascripts/vue_pipelines_index/pipelines_actions_spec.js
@@ -15,6 +15,11 @@ describe('Pipelines Actions dropdown', () => {
name: 'stop_review',
path: '/root/review-app/builds/1893/play',
},
+ {
+ name: 'foo',
+ path: '#',
+ playable: false,
+ },
];
spy = jasmine.createSpy('spy').and.returnValue(Promise.resolve());
@@ -59,4 +64,14 @@ describe('Pipelines Actions dropdown', () => {
expect(component.$el.querySelector('.fa-spinner')).toEqual(null);
});
+
+ it('should render a disabled action when it\'s not playable', () => {
+ expect(
+ component.$el.querySelector('.dropdown-menu li:last-child button').getAttribute('disabled'),
+ ).toEqual('disabled');
+
+ expect(
+ component.$el.querySelector('.dropdown-menu li:last-child button').classList.contains('disabled'),
+ ).toEqual(true);
+ });
});