Skip to content

Commit

Permalink
VLT-1: Improve specs related to approved stories.
Browse files Browse the repository at this point in the history
  • Loading branch information
fbuys committed Jan 23, 2024
1 parent 3e585ba commit 597d0c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions spec/features/action_plan_generate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@

let!(:project) do
FactoryBot.create(:project, parent: parent).tap do |project|
FactoryBot.create(:story, :approved, title: "Second Story", description: "Second", position: 2, project: project, extra_info: "Extra Information")
FactoryBot.create(:story, :approved, title: "Second Story", description: "Second", position: 3, project: project, extra_info: "Extra Information")
FactoryBot.create(:story, :approved, title: "First Story", description: "First", position: 1, project: project)
FactoryBot.create(:story, :pending, title: "Pending task", description: "Pending description", position: 3, project: project)
FactoryBot.create(:story, :pending, title: "Pending task", description: "Pending description", position: 2, project: project)
FactoryBot.create(:story, :rejected, title: "Rejected task", description: "Rejected description", position: 4, project: project)
end
end

let!(:project2) do
FactoryBot.create(:project, parent: parent).tap do |project|
FactoryBot.create(:story, :approved, title: "Third Story", description: "Third", position: 2, project: project)
FactoryBot.create(:story, :approved, title: "Forth Story", description: "Forth", position: 1, project: project)
FactoryBot.create(:story, :rejected, title: "Rejected task", description: "Rejected description", position: 3, project: project)
end
end

Expand Down
5 changes: 3 additions & 2 deletions spec/models/story_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@
describe ".approved" do
it "returns only approved stories" do
approved_stories = FactoryBot.create_list(:story, 2, :approved)
FactoryBot.create_list(:story, 2, :rejected)
FactoryBot.create(:story, :rejected)
FactoryBot.create(:story, :pending)

expect(Story.approved).to eq(approved_stories)
expect(Story.approved.map(&:id).sort).to eq(approved_stories.map(&:id).sort)
end
end
end

0 comments on commit 597d0c9

Please sign in to comment.