diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-05 10:14:33 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-10-05 10:15:40 +0200 |
commit | e3d870d7fc282a1f0a1028996c8b44e5d32b9cbf (patch) | |
tree | 578278b2435415d6684073bafea9d08d24fcf17f /spec/factories | |
parent | 546a3c6561fbe967cc37ccc3229b71893cd20c34 (diff) | |
download | gitlab-ce-e3d870d7fc282a1f0a1028996c8b44e5d32b9cbf.tar.gz |
Add user to Ci::Build to have pusher email address
Diffstat (limited to 'spec/factories')
-rw-r--r-- | spec/factories/ci/builds.rb | 7 | ||||
-rw-r--r-- | spec/factories/ci/commits.rb | 40 |
2 files changed, 9 insertions, 38 deletions
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index 99da5a18776..8e2496398a6 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -27,9 +27,10 @@ FactoryGirl.define do factory :ci_build, class: Ci::Build do + ref 'master' + tag false started_at 'Di 29. Okt 09:51:28 CET 2013' finished_at 'Di 29. Okt 09:53:28 CET 2013' - commands 'ls -a' options do { image: "ruby:2.1", @@ -43,5 +44,9 @@ FactoryGirl.define do started_at nil finished_at nil end + + factory :ci_build_tag do + tag true + end end end diff --git a/spec/factories/ci/commits.rb b/spec/factories/ci/commits.rb index 9c7a0e9cbe0..b74aae795aa 100644 --- a/spec/factories/ci/commits.rb +++ b/spec/factories/ci/commits.rb @@ -18,59 +18,25 @@ # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :ci_commit, class: Ci::Commit do - ref 'master' - before_sha '76de212e80737a608d939f648d959671fb0a0142' sha '97de212e80737a608d939f648d959671fb0a0142' - push_data do - { - ref: 'refs/heads/master', - before: '76de212e80737a608d939f648d959671fb0a0142', - after: '97de212e80737a608d939f648d959671fb0a0142', - user_name: 'Git User', - user_email: 'git@example.com', - repository: { - name: 'test-data', - url: 'ssh://git@gitlab.com/test/test-data.git', - description: '', - homepage: 'http://gitlab.com/test/test-data' - }, - commits: [ - { - id: '97de212e80737a608d939f648d959671fb0a0142', - message: 'Test commit message', - timestamp: '2014-09-23T13:12:25+02:00', - url: 'https://gitlab.com/test/test-data/commit/97de212e80737a608d939f648d959671fb0a0142', - author: { - name: 'Git User', - email: 'git@user.com' - } - } - ], - total_commits_count: 1, - ci_yaml_file: File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) - } - end gl_project factory: :empty_project factory :ci_commit_without_jobs do after(:create) do |commit, evaluator| - commit.push_data[:ci_yaml_file] = YAML.dump({}) - commit.save + allow(commit).to receive(:ci_yaml_file) { YAML.dump({}) } end end factory :ci_commit_with_one_job do after(:create) do |commit, evaluator| - commit.push_data[:ci_yaml_file] = YAML.dump({ rspec: { script: "ls" } }) - commit.save + allow(commit).to receive(:ci_yaml_file) { YAML.dump({ rspec: { script: "ls" } }) } end end factory :ci_commit_with_two_jobs do after(:create) do |commit, evaluator| - commit.push_data[:ci_yaml_file] = YAML.dump({ rspec: { script: "ls" }, spinach: { script: "ls" } }) - commit.save + allow(commit).to receive(:ci_yaml_file) { YAML.dump({ rspec: { script: "ls" }, spinach: { script: "ls" } }) } end end end |