|
21 | 21 | expect(sub_project2.position).to eq 2
|
22 | 22 | end
|
23 | 23 |
|
24 |
| - describe ".with_ordered_descendents" do |
| 24 | + describe ".sub_projects_with_approved_and_ordered_stories" do |
25 | 25 | it "orders sub projects properly" do
|
26 | 26 | parent = FactoryBot.create(:project)
|
27 | 27 | sub_project1 = FactoryBot.create(:project, parent: parent, position: 2)
|
28 |
| - story_5 = FactoryBot.create(:story, project: sub_project1, position: 2) |
29 |
| - story_4 = FactoryBot.create(:story, project: sub_project1, position: 1) |
30 |
| - story_6 = FactoryBot.create(:story, project: sub_project1, position: 3) |
| 28 | + story_5 = FactoryBot.create(:story, :approved, project: sub_project1, position: 2) |
| 29 | + story_4 = FactoryBot.create(:story, :approved, project: sub_project1, position: 1) |
| 30 | + story_6 = FactoryBot.create(:story, :approved, project: sub_project1, position: 3) |
| 31 | + |
31 | 32 | sub_project2 = FactoryBot.create(:project, parent: parent, position: 1)
|
32 |
| - story_3 = FactoryBot.create(:story, project: sub_project2, position: 3) |
33 |
| - story_1 = FactoryBot.create(:story, project: sub_project2, position: 1) |
34 |
| - story_2 = FactoryBot.create(:story, project: sub_project2, position: 2) |
35 |
| - sub_projects = Project.sub_projects_with_ordered_stories(parent.id) |
| 33 | + story_3 = FactoryBot.create(:story, :approved, project: sub_project2, position: 3) |
| 34 | + story_1 = FactoryBot.create(:story, :approved, project: sub_project2, position: 1) |
| 35 | + story_2 = FactoryBot.create(:story, :approved, project: sub_project2, position: 2) |
| 36 | + sub_projects = Project.sub_projects_with_approved_and_ordered_stories(parent.id) |
36 | 37 |
|
37 | 38 | expect(sub_projects.count).to eq 2
|
38 | 39 | expect(sub_projects[0].id).to eq sub_project2.id
|
|
0 commit comments