|
12 | 12 |
|
13 | 13 | context "with only 'loose' items" do |
14 | 14 | context "handles time ranges properly" do |
15 | | - context "all time" do |
| 15 | + context "all time" do |
16 | 16 | before do |
17 | 17 | @distribution_last_year = create(:distribution, :with_items, item: item_1, organization: user.organization, partner: partner_1, issued_at: issued_at_last_year) |
18 | 18 | @distribution_current_1 = create(:distribution, :with_items, item: item_1, organization: user.organization, partner: partner_1, issued_at: issued_at_present) |
19 | 19 | @distribution_current_2 = create(:distribution, :with_items, item: item_2, organization: user.organization, partner: partner_1, issued_at: issued_at_present) |
20 | 20 | end |
21 | 21 |
|
22 | 22 | it("works for all time with no reporting categories") do |
23 | | - visit_distribution_by_county_with_specified_filters("All Time",nil, nil) |
24 | | - expect(page).to have_text("Reporting Category"); |
| 23 | + visit_distribution_by_county_with_specified_filters("All Time", nil, nil) |
25 | 24 | partner_1.profile.served_areas.each do |served_area| |
26 | 25 | expect(page).to have_text(served_area.county.name) |
27 | 26 | end |
|
35 | 34 | @distribution_current = create(:distribution, :with_items, item: item_1, organization: user.organization, partner: partner_1, issued_at: issued_at_present) |
36 | 35 | @distribution_last_year = create(:distribution, :with_items, item: item_1, organization: user.organization, partner: partner_1, issued_at: issued_at_last_year) |
37 | 36 |
|
38 | | - visit_distribution_by_county_with_specified_filters("This Year",nil, nil) |
| 37 | + visit_distribution_by_county_with_specified_filters("This Year", nil, nil) |
39 | 38 |
|
40 | 39 | partner_1.profile.served_areas.each do |served_area| |
41 | 40 | expect(page).to have_text(served_area.county.name) |
|
45 | 44 | expect(page).to have_css("table tbody tr td", text: "$262.50", exact_text: true, count: 4) |
46 | 45 | end |
47 | 46 |
|
48 | | - |
49 | 47 | it("works for this year with reporting categories") do |
50 | 48 | @distribution_current_1 = create(:distribution, :with_items, item: item_1, organization: user.organization, partner: partner_1, issued_at: issued_at_present) |
51 | 49 | @distribution_current_2 = create(:distribution, :with_items, item: item_2, organization: user.organization, partner: partner_1, issued_at: issued_at_present) |
52 | 50 |
|
53 | 51 | @distribution_last_year = create(:distribution, :with_items, item: item_1, organization: user.organization, partner: partner_1, issued_at: issued_at_last_year) |
54 | 52 |
|
55 | | - visit_distribution_by_county_with_specified_filters("This Year","Cloth Diapers", nil) |
| 53 | + visit_distribution_by_county_with_specified_filters("This Year", "Cloth Diapers", nil) |
56 | 54 |
|
57 | 55 | partner_1.profile.served_areas.each do |served_area| |
58 | 56 | expect(page).to have_text(served_area.county.name) |
|
68 | 66 |
|
69 | 67 | @distribution_last_year = create(:distribution, :with_items, item: item_1, organization: user.organization, partner: partner_1, issued_at: issued_at_last_year) |
70 | 68 |
|
71 | | - visit_distribution_by_county_with_specified_filters("All Time","Cloth Diapers", nil) |
| 69 | + visit_distribution_by_county_with_specified_filters("All Time", "Cloth Diapers", nil) |
72 | 70 |
|
73 | 71 | partner_1.profile.served_areas.each do |served_area| |
74 | 72 | expect(page).to have_text(served_area.county.name) |
|
78 | 76 | expect(page).to have_css("table tbody tr td", text: "$525.00", exact_text: true, count: 4) |
79 | 77 | end |
80 | 78 |
|
81 | | - |
82 | | - |
83 | | - |
84 | 79 | it("works for prior year") do |
85 | 80 | # Should NOT return distribution issued before previous calendar year |
86 | 81 | last_day_of_two_years_ago = Time.current.beginning_of_day.change(year: current_year - 2, month: 12, day: 31).to_datetime |
|
94 | 89 | first_day_of_current_year = Time.current.end_of_day.change(year: current_year, month: 1, day: 1).to_datetime |
95 | 90 | create(:distribution, :with_items, item: item_1, organization: user.organization, partner: partner_1, issued_at: first_day_of_current_year) |
96 | 91 |
|
97 | | - visit_distribution_by_county_with_specified_filters("Prior Year",nil, nil) |
| 92 | + visit_distribution_by_county_with_specified_filters("Prior Year", nil, nil) |
98 | 93 |
|
99 | 94 | partner_1.profile.served_areas.each do |served_area| |
100 | 95 | expect(page).to have_text(served_area.county.name) |
|
116 | 111 | tomorrow = 1.day.from_now.end_of_day.to_datetime |
117 | 112 | create(:distribution, :with_items, item: item_1, organization: user.organization, partner: partner_1, issued_at: tomorrow) |
118 | 113 |
|
119 | | - visit_distribution_by_county_with_specified_filters("Last 12 Months",nil, nil) |
| 114 | + visit_distribution_by_county_with_specified_filters("Last 12 Months", nil, nil) |
120 | 115 |
|
121 | 116 | partner_1.profile.served_areas.each do |served_area| |
122 | 117 | expect(page).to have_text(served_area.county.name) |
|
127 | 122 | end |
128 | 123 | end |
129 | 124 |
|
130 | | - |
131 | 125 | context "with kits" do |
132 | 126 | context "with reporting category" do |
133 | 127 | it "works for all time" do |
134 | 128 | @distribution_current_1 = create(:distribution, :with_items, item: kit_a.item, organization: user.organization, partner: partner_1, issued_at: issued_at_present) |
135 | 129 | @distribution_current_2 = create(:distribution, :with_items, item: item_2, organization: user.organization, partner: partner_1, issued_at: issued_at_present) |
136 | 130 | @distribution_last_year_1 = create(:distribution, :with_items, item: kit_a.item, organization: user.organization, partner: partner_1, issued_at: issued_at_last_year) |
137 | 131 | @distribution_last_year_2 = create(:distribution, :with_items, item: item_4, organization: user.organization, partner: partner_1, issued_at: issued_at_last_year) |
138 | | - visit_distribution_by_county_with_specified_filters("All Time","Pads", nil) |
| 132 | + visit_distribution_by_county_with_specified_filters("All Time", "Pads", nil) |
139 | 133 |
|
140 | 134 | partner_1.profile.served_areas.each do |served_area| |
141 | 135 | expect(page).to have_text(served_area.county.name) |
|
152 | 146 | @distribution_current_2 = create(:distribution, :with_items, item: item_2, organization: user.organization, partner: partner_1, issued_at: issued_at_present) |
153 | 147 | @distribution_last_year_1 = create(:distribution, :with_items, item: kit_a.item, organization: user.organization, partner: partner_1, issued_at: issued_at_last_year) |
154 | 148 | @distribution_last_year_2 = create(:distribution, :with_items, item: item_4, organization: user.organization, partner: partner_1, issued_at: issued_at_last_year) |
155 | | - visit_distribution_by_county_with_specified_filters("All Time",nil, item_3.name) |
| 149 | + visit_distribution_by_county_with_specified_filters("All Time", nil, item_3.name) |
156 | 150 |
|
157 | 151 | partner_1.profile.served_areas.each do |served_area| |
158 | 152 | expect(page).to have_text(served_area.county.name) |
|
0 commit comments