summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-04-16 16:25:25 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-04-16 16:30:16 -0400
commitdee52393b5b76c5d30addbfe7ba43e718b67a371 (patch)
treef8dc6343ca0e95ef7882e2916b10b4059da4173d
parent2dace3679fb9a086a015dcca213c6e563a08764e (diff)
downloadgitlab-ce-dee52393b5b76c5d30addbfe7ba43e718b67a371.tar.gz
Correct usage of `subject` in specs
-rw-r--r--spec/models/commit_spec.rb3
-rw-r--r--spec/models/issue_spec.rb3
-rw-r--r--spec/models/merge_request_spec.rb5
-rw-r--r--spec/models/note_spec.rb3
-rw-r--r--spec/support/mentionable_shared_examples.rb2
-rw-r--r--spec/support/taskable_shared_examples.rb2
6 files changed, 11 insertions, 7 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb
index 11cc7762ce4..2cc23efb986 100644
--- a/spec/models/commit_spec.rb
+++ b/spec/models/commit_spec.rb
@@ -69,8 +69,9 @@ eos
end
it_behaves_like 'a mentionable' do
- let(:subject) { commit }
let(:mauthor) { create :user, email: commit.author_email }
+ subject { commit }
+
let(:backref_text) { "commit #{subject.id}" }
let(:set_mentionable_text) { ->(txt){ subject.stub(safe_message: txt) } }
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb
index 087e40c3d84..20d823b40e5 100644
--- a/spec/models/issue_spec.rb
+++ b/spec/models/issue_spec.rb
@@ -56,7 +56,8 @@ describe Issue do
end
it_behaves_like 'an editable mentionable' do
- let(:subject) { create :issue, project: mproject }
+ subject { create(:issue, project: project) }
+
let(:backref_text) { "issue ##{subject.iid}" }
let(:set_mentionable_text) { ->(txt){ subject.description = txt } }
end
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index d40503d791c..3fcd063efe8 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -116,12 +116,13 @@ describe MergeRequest do
end
it_behaves_like 'an editable mentionable' do
- let(:subject) { create :merge_request, source_project: mproject, target_project: mproject }
+ subject { create(:merge_request, source_project: project, target_project: project) }
+
let(:backref_text) { "merge request !#{subject.iid}" }
let(:set_mentionable_text) { ->(txt){ subject.title = txt } }
end
it_behaves_like 'a Taskable' do
- let(:subject) { create :merge_request, :simple }
+ subject { create :merge_request, :simple }
end
end
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index a7bf5081d5b..e7e6717e775 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -629,8 +629,9 @@ describe Note do
end
it_behaves_like 'an editable mentionable' do
+ subject { create :note, noteable: issue, project: project }
+
let(:issue) { create :issue, project: project }
- let(:subject) { create :note, noteable: issue, project: project }
let(:backref_text) { issue.gfm_reference }
let(:set_mentionable_text) { ->(txt) { subject.note = txt } }
end
diff --git a/spec/support/mentionable_shared_examples.rb b/spec/support/mentionable_shared_examples.rb
index 305592fa5a6..35ed126b5bc 100644
--- a/spec/support/mentionable_shared_examples.rb
+++ b/spec/support/mentionable_shared_examples.rb
@@ -1,6 +1,6 @@
# Specifications for behavior common to all Mentionable implementations.
# Requires a shared context containing:
-# - let(:subject) { "the mentionable implementation" }
+# - subject { "the mentionable implementation" }
# - let(:backref_text) { "the way that +subject+ should refer to itself in backreferences " }
# - let(:set_mentionable_text) { lambda { |txt| "block that assigns txt to the subject's mentionable_text" } }
diff --git a/spec/support/taskable_shared_examples.rb b/spec/support/taskable_shared_examples.rb
index 490f453d468..8e5e3a8aafc 100644
--- a/spec/support/taskable_shared_examples.rb
+++ b/spec/support/taskable_shared_examples.rb
@@ -1,7 +1,7 @@
# Specs for task state functionality for issues and merge requests.
#
# Requires a context containing:
-# let(:subject) { Issue or MergeRequest }
+# subject { Issue or MergeRequest }
shared_examples 'a Taskable' do
before do
subject.description = <<EOT.gsub(/ {6}/, '')