Budget and phases specs updated (model specs) to include the new 'Information' phase
This commit is contained in:
@@ -4,16 +4,18 @@ describe Budget::Phase do
|
||||
|
||||
let(:budget) { create(:budget) }
|
||||
let(:first_phase) { budget.phases.drafting }
|
||||
let(:second_phase) { budget.phases.accepting }
|
||||
let(:third_phase) { budget.phases.reviewing }
|
||||
let(:fourth_phase) { budget.phases.selecting }
|
||||
let(:final_phase) { budget.phases.finished}
|
||||
let(:second_phase) { budget.phases.informing }
|
||||
let(:third_phase) { budget.phases.accepting }
|
||||
let(:fourth_phase) { budget.phases.reviewing }
|
||||
let(:fifth_phase) { budget.phases.selecting }
|
||||
let(:final_phase) { budget.phases.finished}
|
||||
|
||||
before do
|
||||
first_phase.update_attributes(starts_at: Date.current - 3.days, ends_at: Date.current - 1.day)
|
||||
second_phase.update_attributes(starts_at: Date.current - 1.days, ends_at: Date.current + 1.day)
|
||||
third_phase.update_attributes(starts_at: Date.current + 1.days, ends_at: Date.current + 3.day)
|
||||
fourth_phase.update_attributes(starts_at: Date.current + 3.days, ends_at: Date.current + 5.day)
|
||||
fifth_phase.update_attributes(starts_at: Date.current + 5.days, ends_at: Date.current + 7.day)
|
||||
end
|
||||
|
||||
describe "validates" do
|
||||
@@ -90,7 +92,7 @@ describe Budget::Phase do
|
||||
|
||||
describe "#next_phase_dates_valid?" do
|
||||
let(:error) do
|
||||
"End date must be earlier than the end date of the next enabled phase (Reviewing projects)"
|
||||
"End date must be earlier than the end date of the next enabled phase (Accepting projects)"
|
||||
end
|
||||
|
||||
it "is invalid when end date is same as next enabled phase end date" do
|
||||
|
||||
@@ -192,6 +192,7 @@ describe Budget do
|
||||
|
||||
describe "#generate_phases" do
|
||||
let(:drafting_phase) { budget.phases.drafting }
|
||||
let(:informing_phase) { budget.phases.informing }
|
||||
let(:accepting_phase) { budget.phases.accepting }
|
||||
let(:reviewing_phase) { budget.phases.reviewing }
|
||||
let(:selecting_phase) { budget.phases.selecting }
|
||||
@@ -204,7 +205,8 @@ describe Budget do
|
||||
it "generates all phases linked in correct order" do
|
||||
expect(budget.phases.count).to eq(Budget::Phase::PHASE_KINDS.count)
|
||||
|
||||
expect(drafting_phase.next_phase).to eq(accepting_phase)
|
||||
expect(drafting_phase.next_phase).to eq(informing_phase)
|
||||
expect(informing_phase.next_phase).to eq(accepting_phase)
|
||||
expect(accepting_phase.next_phase).to eq(reviewing_phase)
|
||||
expect(reviewing_phase.next_phase).to eq(selecting_phase)
|
||||
expect(selecting_phase.next_phase).to eq(valuating_phase)
|
||||
@@ -215,7 +217,8 @@ describe Budget do
|
||||
expect(finished_phase.next_phase).to eq(nil)
|
||||
|
||||
expect(drafting_phase.prev_phase).to eq(nil)
|
||||
expect(accepting_phase.prev_phase).to eq(drafting_phase)
|
||||
expect(informing_phase.prev_phase).to eq(drafting_phase)
|
||||
expect(accepting_phase.prev_phase).to eq(informing_phase)
|
||||
expect(reviewing_phase.prev_phase).to eq(accepting_phase)
|
||||
expect(selecting_phase.prev_phase).to eq(reviewing_phase)
|
||||
expect(valuating_phase.prev_phase).to eq(selecting_phase)
|
||||
|
||||
Reference in New Issue
Block a user