Commit 4e5e21df authored by Bob Van Landuyt's avatar Bob Van Landuyt

Use a named subject in `models/ee/board_spec.rb`

parent 2cd6f88c
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Board do describe Board do
describe 'milestone' do describe 'milestone' do
subject { build(:board) } subject(:board) { build(:board) }
context 'when the feature is available' do context 'when the feature is available' do
before do before do
...@@ -10,31 +10,31 @@ describe Board do ...@@ -10,31 +10,31 @@ describe Board do
end end
it 'returns Milestone::Upcoming for upcoming milestone id' do it 'returns Milestone::Upcoming for upcoming milestone id' do
subject.milestone_id = Milestone::Upcoming.id board.milestone_id = Milestone::Upcoming.id
expect(subject.milestone).to eq Milestone::Upcoming expect(board.milestone).to eq Milestone::Upcoming
end end
it 'returns milestone for valid milestone id' do it 'returns milestone for valid milestone id' do
milestone = create(:milestone) milestone = create(:milestone)
subject.milestone_id = milestone.id board.milestone_id = milestone.id
expect(subject.milestone).to eq milestone expect(board.milestone).to eq milestone
end end
it 'returns nil for invalid milestone id' do it 'returns nil for invalid milestone id' do
subject.milestone_id = -1 board.milestone_id = -1
expect(subject.milestone).to be_nil expect(board.milestone).to be_nil
end end
end end
it 'returns nil when the feature is not available' do it 'returns nil when the feature is not available' do
stub_licensed_features(issue_board_milestone: false) stub_licensed_features(issue_board_milestone: false)
milestone = create(:milestone) milestone = create(:milestone)
subject.milestone_id = milestone.id board.milestone_id = milestone.id
expect(subject.milestone).to be_nil expect(board.milestone).to be_nil
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment