diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-04-21 16:13:40 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-04-24 13:29:36 +0300 |
commit | 8ed7ac9d443563a62a6aa03a2ec72b9fcb0d2df1 (patch) | |
tree | b787add194486ac4346c2de2874b32db6d37c635 /spec | |
parent | 84a1590252c63c710bceaa7a394799cdc5109505 (diff) |
Use project.commit convenience method.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/commit_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/gitlab_flavored_markdown_spec.rb | 2 | ||||
-rw-r--r-- | spec/helpers/diff_helper_spec.rb | 2 | ||||
-rw-r--r-- | spec/helpers/gitlab_markdown_helper_spec.rb | 2 | ||||
-rw-r--r-- | spec/helpers/tree_helper_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/diff/file_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/diff/parser_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/markdown/commit_range_reference_filter_spec.rb | 8 | ||||
-rw-r--r-- | spec/lib/gitlab/markdown/commit_reference_filter_spec.rb | 4 | ||||
-rw-r--r-- | spec/lib/gitlab/reference_extractor_spec.rb | 6 | ||||
-rw-r--r-- | spec/mailers/notify_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/commit_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/note_spec.rb | 6 | ||||
-rw-r--r-- | spec/services/git_push_service_spec.rb | 6 | ||||
-rw-r--r-- | spec/services/git_tag_push_service_spec.rb | 2 |
15 files changed, 25 insertions, 25 deletions
diff --git a/spec/controllers/commit_controller_spec.rb b/spec/controllers/commit_controller_spec.rb index 3394a1f863f..2cfa399a047 100644 --- a/spec/controllers/commit_controller_spec.rb +++ b/spec/controllers/commit_controller_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Projects::CommitController do let(:project) { create(:project) } let(:user) { create(:user) } - let(:commit) { project.repository.commit("master") } + let(:commit) { project.commit("master") } before do sign_in(user) diff --git a/spec/features/gitlab_flavored_markdown_spec.rb b/spec/features/gitlab_flavored_markdown_spec.rb index fca1a06eb88..133beba7b98 100644 --- a/spec/features/gitlab_flavored_markdown_spec.rb +++ b/spec/features/gitlab_flavored_markdown_spec.rb @@ -14,7 +14,7 @@ describe "GitLab Flavored Markdown", feature: true do Commit.any_instance.stub(title: "fix ##{issue.iid}\n\nask @#{fred.username} for details") end - let(:commit) { project.repository.commit } + let(:commit) { project.commit } before do login_as :user diff --git a/spec/helpers/diff_helper_spec.rb b/spec/helpers/diff_helper_spec.rb index 5bd09793b11..95719b4b49f 100644 --- a/spec/helpers/diff_helper_spec.rb +++ b/spec/helpers/diff_helper_spec.rb @@ -4,7 +4,7 @@ describe DiffHelper do include RepoHelpers let(:project) { create(:project) } - let(:commit) { project.repository.commit(sample_commit.id) } + let(:commit) { project.commit(sample_commit.id) } let(:diff) { commit.diffs.first } let(:diff_file) { Gitlab::Diff::File.new(diff) } diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index 64f130e4ae4..e309dbb6a2f 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -6,7 +6,7 @@ describe GitlabMarkdownHelper do let!(:project) { create(:project) } let(:user) { create(:user, username: 'gfm') } - let(:commit) { project.repository.commit } + let(:commit) { project.commit } let(:issue) { create(:issue, project: project) } let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } let(:snippet) { create(:project_snippet, project: project) } diff --git a/spec/helpers/tree_helper_spec.rb b/spec/helpers/tree_helper_spec.rb index 8271e00f41b..2013b3e4c2a 100644 --- a/spec/helpers/tree_helper_spec.rb +++ b/spec/helpers/tree_helper_spec.rb @@ -6,7 +6,7 @@ describe TreeHelper do before { @repository = project.repository - @commit = project.repository.commit("e56497bb") + @commit = project.commit("e56497bb") } context "on a directory containing more than one file/directory" do diff --git a/spec/lib/gitlab/diff/file_spec.rb b/spec/lib/gitlab/diff/file_spec.rb index 40eb45e37ca..8b7946f3117 100644 --- a/spec/lib/gitlab/diff/file_spec.rb +++ b/spec/lib/gitlab/diff/file_spec.rb @@ -4,7 +4,7 @@ describe Gitlab::Diff::File do include RepoHelpers let(:project) { create(:project) } - let(:commit) { project.repository.commit(sample_commit.id) } + let(:commit) { project.commit(sample_commit.id) } let(:diff) { commit.diffs.first } let(:diff_file) { Gitlab::Diff::File.new(diff) } diff --git a/spec/lib/gitlab/diff/parser_spec.rb b/spec/lib/gitlab/diff/parser_spec.rb index 918f6d0ead4..4d5d1431683 100644 --- a/spec/lib/gitlab/diff/parser_spec.rb +++ b/spec/lib/gitlab/diff/parser_spec.rb @@ -4,7 +4,7 @@ describe Gitlab::Diff::Parser do include RepoHelpers let(:project) { create(:project) } - let(:commit) { project.repository.commit(sample_commit.id) } + let(:commit) { project.commit(sample_commit.id) } let(:diff) { commit.diffs.first } let(:parser) { Gitlab::Diff::Parser.new } diff --git a/spec/lib/gitlab/markdown/commit_range_reference_filter_spec.rb b/spec/lib/gitlab/markdown/commit_range_reference_filter_spec.rb index 5ebdc8926e2..f0804ce0056 100644 --- a/spec/lib/gitlab/markdown/commit_range_reference_filter_spec.rb +++ b/spec/lib/gitlab/markdown/commit_range_reference_filter_spec.rb @@ -5,8 +5,8 @@ module Gitlab::Markdown include ReferenceFilterSpecHelper let(:project) { create(:project) } - let(:commit1) { project.repository.commit } - let(:commit2) { project.repository.commit("HEAD~2") } + let(:commit1) { project.commit } + let(:commit2) { project.commit("HEAD~2") } it 'requires project context' do expect { described_class.call('Commit Range 1c002d..d200c1', {}) }. @@ -86,8 +86,8 @@ module Gitlab::Markdown context 'cross-project reference' do let(:namespace) { create(:namespace, name: 'cross-reference') } let(:project2) { create(:project, namespace: namespace) } - let(:commit1) { project.repository.commit } - let(:commit2) { project.repository.commit("HEAD~2") } + let(:commit1) { project.commit } + let(:commit2) { project.commit("HEAD~2") } let(:reference) { "#{project2.path_with_namespace}@#{commit1.id}...#{commit2.id}" } context 'when user can access reference' do diff --git a/spec/lib/gitlab/markdown/commit_reference_filter_spec.rb b/spec/lib/gitlab/markdown/commit_reference_filter_spec.rb index 71fd2db2c58..f792d7f696e 100644 --- a/spec/lib/gitlab/markdown/commit_reference_filter_spec.rb +++ b/spec/lib/gitlab/markdown/commit_reference_filter_spec.rb @@ -5,7 +5,7 @@ module Gitlab::Markdown include ReferenceFilterSpecHelper let(:project) { create(:project) } - let(:commit) { project.repository.commit } + let(:commit) { project.commit } it 'requires project context' do expect { described_class.call('Commit 1c002d', {}) }. @@ -80,7 +80,7 @@ module Gitlab::Markdown context 'cross-project reference' do let(:namespace) { create(:namespace, name: 'cross-reference') } let(:project2) { create(:project, namespace: namespace) } - let(:commit) { project.repository.commit } + let(:commit) { project.commit } let(:reference) { "#{project2.path_with_namespace}@#{commit.id}" } context 'when user can access reference' do diff --git a/spec/lib/gitlab/reference_extractor_spec.rb b/spec/lib/gitlab/reference_extractor_spec.rb index 6fba140f69d..0f4ea2a24ed 100644 --- a/spec/lib/gitlab/reference_extractor_spec.rb +++ b/spec/lib/gitlab/reference_extractor_spec.rb @@ -125,7 +125,7 @@ describe Gitlab::ReferenceExtractor do end it 'accesses valid commits' do - commit = project.repository.commit('master') + commit = project.commit('master') subject.analyze("this references commits #{commit.sha[0..6]} and 012345") extracted = subject.commits @@ -135,8 +135,8 @@ describe Gitlab::ReferenceExtractor do end it 'accesses valid commit ranges' do - commit = project.repository.commit('master') - earlier_commit = project.repository.commit('master~2') + commit = project.commit('master') + earlier_commit = project.commit('master~2') subject.analyze("this references commits #{earlier_commit.sha[0..6]}...#{commit.sha[0..6]}") extracted = subject.commit_ranges diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index 6f7f5835b94..d28b4768545 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -466,7 +466,7 @@ describe Notify do end describe 'on a commit' do - let(:commit) { project.repository.commit } + let(:commit) { project.commit } before(:each) { allow(note).to receive(:noteable).and_return(commit) } diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index 506bc3339b6..9c37c036eae 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe Commit do let(:project) { create :project } - let(:commit) { project.repository.commit } + let(:commit) { project.commit } describe '#title' do it "returns no_commit_message when safe_message is blank" do diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index e7e6717e775..095eb1500a9 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -329,7 +329,7 @@ describe Note do let(:author) { create(:user) } let(:issue) { create(:issue, project: project) } let(:mergereq) { create(:merge_request, :simple, target_project: project, source_project: project) } - let(:commit) { project.repository.commit } + let(:commit) { project.commit } # Test all of {issue, merge request, commit} in both the referenced and referencing # roles, to ensure that the correct information can be inferred from any argument. @@ -482,8 +482,8 @@ describe Note do let(:project) { create :project } let(:author) { create :user } let(:issue) { create :issue } - let(:commit0) { project.repository.commit } - let(:commit1) { project.repository.commit('HEAD~2') } + let(:commit0) { project.commit } + let(:commit1) { project.commit('HEAD~2') } before do Note.create_cross_reference_note(issue, commit0, author, project) diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb index aa9b15dd9ec..246bc1cc33d 100644 --- a/spec/services/git_push_service_spec.rb +++ b/spec/services/git_push_service_spec.rb @@ -44,7 +44,7 @@ describe GitPushService do before do service.execute(project, user, @oldrev, @newrev, @ref) @push_data = service.push_data - @commit = project.repository.commit(@newrev) + @commit = project.commit(@newrev) end subject { @push_data } @@ -151,7 +151,7 @@ describe GitPushService do describe "cross-reference notes" do let(:issue) { create :issue, project: project } let(:commit_author) { create :user } - let(:commit) { project.repository.commit } + let(:commit) { project.commit } before do commit.stub({ @@ -198,7 +198,7 @@ describe GitPushService do let(:issue) { create :issue, project: project } let(:other_issue) { create :issue, project: project } let(:commit_author) { create :user } - let(:closing_commit) { project.repository.commit } + let(:closing_commit) { project.commit } before do closing_commit.stub({ diff --git a/spec/services/git_tag_push_service_spec.rb b/spec/services/git_tag_push_service_spec.rb index a050fdf6c0e..76f69b396e0 100644 --- a/spec/services/git_tag_push_service_spec.rb +++ b/spec/services/git_tag_push_service_spec.rb @@ -19,7 +19,7 @@ describe GitTagPushService do @push_data = service.push_data @tag_name = Gitlab::Git.ref_name(@ref) @tag = project.repository.find_tag(@tag_name) - @commit = project.repository.commit(@tag.target) + @commit = project.commit(@tag.target) end subject { @push_data } |