summaryrefslogtreecommitdiff
path: root/spec/models/milestone_spec.rb
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-07-25 19:09:00 +0200
committerRémy Coutable <remy@rymai.me>2017-07-27 14:31:53 +0200
commitcddc5cacfb833fbd188d2f5982381f66dd3eee3b (patch)
treede3e7bda37c8b7f0eb5586695d6d871484dc44e2 /spec/models/milestone_spec.rb
parentddccd24c1388dadc057ac3c4c0a49f3fea847292 (diff)
downloadgitlab-ce-cddc5cacfb833fbd188d2f5982381f66dd3eee3b.tar.gz
Use described_class when possible
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/models/milestone_spec.rb')
-rw-r--r--spec/models/milestone_spec.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb
index 0dd8a86106b..aa376e242e8 100644
--- a/spec/models/milestone_spec.rb
+++ b/spec/models/milestone_spec.rb
@@ -37,13 +37,13 @@ describe Milestone do
describe "unique milestone title" do
context "per project" do
it "does not accept the same title in a project twice" do
- new_milestone = Milestone.new(project: milestone.project, title: milestone.title)
+ new_milestone = described_class.new(project: milestone.project, title: milestone.title)
expect(new_milestone).not_to be_valid
end
it "accepts the same title in another project" do
project = create(:empty_project)
- new_milestone = Milestone.new(project: project, title: milestone.title)
+ new_milestone = described_class.new(project: project, title: milestone.title)
expect(new_milestone).to be_valid
end
@@ -58,7 +58,7 @@ describe Milestone do
end
it "does not accept the same title in a group twice" do
- new_milestone = Milestone.new(group: group, title: milestone.title)
+ new_milestone = described_class.new(group: group, title: milestone.title)
expect(new_milestone).not_to be_valid
end
@@ -66,7 +66,7 @@ describe Milestone do
it "does not accept the same title of a child project milestone" do
create(:milestone, project: group.projects.first)
- new_milestone = Milestone.new(group: group, title: milestone.title)
+ new_milestone = described_class.new(group: group, title: milestone.title)
expect(new_milestone).not_to be_valid
end
@@ -214,7 +214,7 @@ describe Milestone do
# The call to `#try` is because this returns a relation with a Postgres DB,
# and an array of IDs with a MySQL DB.
- let(:milestone_ids) { Milestone.upcoming_ids_by_projects(projects).map { |id| id.try(:id) || id } }
+ let(:milestone_ids) { described_class.upcoming_ids_by_projects(projects).map { |id| id.try(:id) || id } }
it 'returns the next upcoming open milestone ID for each project' do
expect(milestone_ids).to contain_exactly(current_milestone_project_1.id, current_milestone_project_2.id)