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'
describe Board do
describe 'milestone' do
subject { build(:board) }
subject(:board) { build(:board) }
context 'when the feature is available' do
before do
......@@ -10,31 +10,31 @@ describe Board do
end
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
it 'returns milestone for valid milestone id' do
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
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
it 'returns nil when the feature is not available' do
stub_licensed_features(issue_board_milestone: false)
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
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