summaryrefslogtreecommitdiff
path: root/spec/javascripts/fixtures
diff options
context:
space:
mode:
authorwinh <winnie@gitlab.com>2017-05-05 12:34:42 +0200
committerwinh <winnie@gitlab.com>2017-05-10 18:12:18 +0200
commita7a53cd012a792828b0832242f15c33c4bb21d0e (patch)
tree5f5f92758c805b5353cc44512a4c50a6099b8426 /spec/javascripts/fixtures
parent1daa133c04532d80c524439fc5ef931daada6303 (diff)
downloadgitlab-ce-a7a53cd012a792828b0832242f15c33c4bb21d0e.tar.gz
Replace pipeline mock data with JSON fixture
Diffstat (limited to 'spec/javascripts/fixtures')
-rw-r--r--spec/javascripts/fixtures/pipelines.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/javascripts/fixtures/pipelines.rb b/spec/javascripts/fixtures/pipelines.rb
new file mode 100644
index 00000000000..daafbac86db
--- /dev/null
+++ b/spec/javascripts/fixtures/pipelines.rb
@@ -0,0 +1,35 @@
+require 'spec_helper'
+
+describe Projects::PipelinesController, '(JavaScript fixtures)', type: :controller do
+ include JavaScriptFixturesHelpers
+
+ let(:admin) { create(:admin) }
+ let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
+ let(:project) { create(:project, :repository, namespace: namespace, path: 'pipelines-project') }
+ let(:commit) { create(:commit, project: project) }
+ let(:commit_without_author) { RepoHelpers.another_sample_commit }
+ let!(:user) { create(:user, email: commit.author_email) }
+ let!(:pipeline) { create(:ci_pipeline, project: project, sha: commit.id, user: user) }
+ let!(:pipeline_without_author) { create(:ci_pipeline, project: project, sha: commit_without_author.id) }
+ let!(:pipeline_without_commit) { create(:ci_pipeline, project: project, sha: '0000') }
+
+ render_views
+
+ before(:all) do
+ clean_frontend_fixtures('pipelines/')
+ end
+
+ before(:each) do
+ sign_in(admin)
+ end
+
+ it 'pipelines/pipelines.json' do |example|
+ get :index,
+ namespace_id: namespace,
+ project_id: project,
+ format: :json
+
+ expect(response).to be_success
+ store_frontend_fixture(response, example.description)
+ end
+end