Skip to content

Commit c4605dc

Browse files
Create factories only when necessary
1 parent 943428c commit c4605dc

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

spec/models/view/request_info_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
end
3535

3636
describe "#custom_units" do
37-
context "when a request has request units for an item request" do
37+
context "when there are request units for an item request" do
3838
context "when enable_packs is disabled" do
3939
it "returns false" do
4040
organization = build(:organization)

spec/models/view/requests_spec.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
RSpec.describe View::Requests do
22
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)
55
create(:request, :pending, organization:)
66
create(:request, :started, organization:)
77
create(:request, :fulfilled, organization:)
@@ -13,9 +13,9 @@
1313
end
1414

1515
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:)
1919
total_items_service_double = instance_double(RequestsTotalItemsService, calculate: {"Diaper" => 10})
2020
allow(RequestsTotalItemsService).to receive(:new).with(requests: organization.requests).and_return(total_items_service_double)
2121

@@ -26,9 +26,9 @@
2626
end
2727

2828
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:)
3232
params = ActionController::Parameters.new(
3333
{
3434
filters: {
@@ -50,7 +50,7 @@
5050
end
5151

5252
def helpers
53-
Class.new do
53+
Module.new do
5454
def self.selected_range
5555
(1.month.ago..2.days.from_now)
5656
end

0 commit comments

Comments
 (0)