|
1 | 1 | RSpec.describe View::Requests do |
2 | 2 | describe "#unfulfilled_requests_count" do |
3 | | - it "returns the unfulfilled requests count for the given date range" do |
4 | | - organization = create(:organization) |
| 3 | + it "returns the unfulfilled requests count" do |
| 4 | + organization = build(:organization) |
5 | 5 | create(:request, :pending, organization:) |
6 | 6 | create(:request, :started, organization:) |
7 | 7 | create(:request, :fulfilled, organization:) |
|
13 | 13 | end |
14 | 14 |
|
15 | 15 | describe "#calculate_product_totals" do |
16 | | - it "returns the product total items service" do |
17 | | - organization = create(:organization) |
18 | | - create(:request, :pending, organization:) |
| 16 | + it "returns the calculated product total items" do |
| 17 | + organization = build(:organization) |
| 18 | + build(:request, :pending, organization:) |
19 | 19 | total_items_service_double = instance_double(RequestsTotalItemsService, calculate: {"Diaper" => 10}) |
20 | 20 | allow(RequestsTotalItemsService).to receive(:new).with(requests: organization.requests).and_return(total_items_service_double) |
21 | 21 |
|
|
26 | 26 | end |
27 | 27 |
|
28 | 28 | describe "selected filter params" do |
29 | | - it "returns the filter params given" do |
30 | | - organization = create(:organization) |
31 | | - create(:request, :pending, organization:) |
| 29 | + it "returns the given filter params" do |
| 30 | + organization = build(:organization) |
| 31 | + build(:request, :pending, organization:) |
32 | 32 | params = ActionController::Parameters.new( |
33 | 33 | { |
34 | 34 | filters: { |
|
50 | 50 | end |
51 | 51 |
|
52 | 52 | def helpers |
53 | | - Class.new do |
| 53 | + Module.new do |
54 | 54 | def self.selected_range |
55 | 55 | (1.month.ago..2.days.from_now) |
56 | 56 | end |
|
0 commit comments