Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get rid of destroy_all in tests #414

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions rails_application/test/client_authentication/create_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ module ClientAuthentication
class CreateTest < InMemoryTestCase
cover "Authentication*"

def setup
super
Account.destroy_all
end

def test_set_create
customer_id = SecureRandom.uuid
product_id = SecureRandom.uuid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ module ClientAuthentication
class SetPasswordTest < InMemoryTestCase
cover "Authentication*"

def setup
super
Account.destroy_all
end

def test_set_password
customer_id = SecureRandom.uuid
account_id = SecureRandom.uuid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ module ClientOrders
class CustomerRegisteredTest < InMemoryTestCase
cover "ClientOrders*"

def setup
super
Client.destroy_all
end

def test_customer_registered
event_store = Rails.configuration.event_store

Expand Down Expand Up @@ -52,4 +47,4 @@ def test_customer_assigned_to_order
end

end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ module ClientOrders
class ItemAddedToBasketTest < InMemoryTestCase
cover "ClientOrders*"

def setup
super
Order.destroy_all
OrderLine.destroy_all
end

def test_add_new_item
event_store = Rails.configuration.event_store

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ module ClientOrders
class ItemRemovedFromBasketTest < InMemoryTestCase
cover "ClientOrders*"

def setup
super
Order.destroy_all
OrderLine.destroy_all
Product.destroy_all
end

def test_remove_item_when_quantity_gt_1
event_store = Rails.configuration.event_store

Expand Down
6 changes: 0 additions & 6 deletions rails_application/test/client_orders/order_cancelled_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ module ClientOrders
class OrderCancelledTest < InMemoryTestCase
cover "ClientOrders*"

def setup
super
Client.destroy_all
Order.destroy_all
end

def test_order_confirmed
event_store = Rails.configuration.event_store
customer_id = SecureRandom.uuid
Expand Down
8 changes: 1 addition & 7 deletions rails_application/test/client_orders/order_expired_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ module ClientOrders
class OrderExpiredTest < InMemoryTestCase
cover "ClientOrders*"

def setup
super
Client.destroy_all
Order.destroy_all
end

def test_order_expired
event_store = Rails.configuration.event_store
customer_id = SecureRandom.uuid
Expand Down Expand Up @@ -49,4 +43,4 @@ def test_order_expired
assert_equal("Expired", orders.first.state)
end
end
end
end
6 changes: 0 additions & 6 deletions rails_application/test/client_orders/order_paid_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ module ClientOrders
class OrderConfirmedTest < InMemoryTestCase
cover "ClientOrders*"

def setup
super
Client.destroy_all
Order.destroy_all
end

def test_order_confirmed
event_store = Rails.configuration.event_store
customer_id = SecureRandom.uuid
Expand Down
8 changes: 1 addition & 7 deletions rails_application/test/client_orders/order_placed_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ module ClientOrders
class OrderPlacedTest < InMemoryTestCase
cover "ClientOrders*"

def setup
super
Client.destroy_all
Order.destroy_all
end

def test_order_placed
event_store = Rails.configuration.event_store
customer_id = SecureRandom.uuid
Expand Down Expand Up @@ -94,4 +88,4 @@ def assert_clickable_order_number(customer_id, order_id, order_number)
assert_equal(order_number, links_to_orders.first.text)
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ module ClientOrders
class UpdatePaidOrdersSummaryTest < InMemoryTestCase
cover "ClientOrders*"

def setup
super
Client.destroy_all
end

def test_update_orders_summary
customer_id = SecureRandom.uuid
other_customer_id = SecureRandom.uuid
Expand Down
5 changes: 0 additions & 5 deletions rails_application/test/customers/connect_account_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ module Customers
class ConnectAccountTest < InMemoryTestCase
cover "Customers"

def setup
super
Customer.destroy_all
end

def test_first_register_then_connect
customer_id = SecureRandom.uuid
account_id = SecureRandom.uuid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ module Customers
class CustomerPromotedToVipTest < InMemoryTestCase
cover "Customers"

def setup
super
Customer.destroy_all
end

def test_promote_customer_to_vip
event_store = Rails.configuration.event_store

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ module Customers
class UpdatePaidOrdersSummaryTest < InMemoryTestCase
cover "Customers"

def setup
super
Customer.destroy_all
end

def test_update_orders_summary
customer_id = SecureRandom.uuid
other_customer_id = SecureRandom.uuid
Expand Down
3 changes: 0 additions & 3 deletions rails_application/test/integration/client_orders_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ class ClientOrdersTests < InMemoryRESIntegrationTestCase
def setup
super
Rails.configuration.payment_gateway.call.reset
ClientOrders::Client.destroy_all
ClientOrders::Order.destroy_all
Orders::Order.destroy_all
add_available_vat_rate(10)
end

Expand Down
1 change: 0 additions & 1 deletion rails_application/test/integration/discount_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
class DiscountTest < InMemoryRESIntegrationTestCase
def setup
super
Orders::Order.destroy_all
add_available_vat_rate(10)
end

Expand Down
5 changes: 0 additions & 5 deletions rails_application/test/integration/login_test.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
require "test_helper"

class LoginTest < InMemoryRESIntegrationTestCase
def setup
super
Customers::Customer.destroy_all
end

def test_login
password = "1234qwer"
customer_id = register_customer("Arkency")
Expand Down
1 change: 0 additions & 1 deletion rails_application/test/integration/orders_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class OrdersTest < InMemoryRESIntegrationTestCase
def setup
super
Rails.configuration.payment_gateway.call.reset
Orders::Order.destroy_all
add_available_vat_rate(10)
end

Expand Down
7 changes: 0 additions & 7 deletions rails_application/test/invoices/invoices_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ module Invoices
class InvoicesTest < InMemoryRESIntegrationTestCase
cover "Invoices*"

def setup
super
Invoice.destroy_all
InvoiceItem.destroy_all
Order.destroy_all
end

def test_create_draft_order_when_not_exists
event_store = Rails.configuration.event_store
order_id = SecureRandom.uuid
Expand Down
8 changes: 1 addition & 7 deletions rails_application/test/orders/assign_customer_first_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ module Orders
class AssignCustomerFirstTest < InMemoryTestCase
cover "Orders*"

def setup
super
Order.destroy_all
OrderLine.destroy_all
end

def test_create_draft_order_when_not_exists
event_store = Rails.configuration.event_store
customer_id = SecureRandom.uuid
Expand All @@ -24,4 +18,4 @@ def test_create_draft_order_when_not_exists
assert event_store.event_in_stream?(customer_registered.event_id, "Orders$all")
end
end
end
end
7 changes: 1 addition & 6 deletions rails_application/test/orders/customer_registered_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ module Orders
class CustomerRegisteredTest < InMemoryTestCase
cover "Orders*"

def setup
super
Customer.destroy_all
end

def test_customer_registered
event_store = Rails.configuration.event_store

Expand Down Expand Up @@ -52,4 +47,4 @@ def test_customer_assigned_to_order
end

end
end
end
6 changes: 0 additions & 6 deletions rails_application/test/orders/item_added_to_basket_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ module Orders
class ItemAddedToBasketTest < InMemoryTestCase
cover "Orders*"

def setup
super
Order.destroy_all
OrderLine.destroy_all
end

def test_add_new_item
event_store = Rails.configuration.event_store

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ module Orders
class ItemRemovedFromBasketTest < InMemoryTestCase
cover "Orders*"

def setup
super
Order.destroy_all
OrderLine.destroy_all
Product.destroy_all
end

def test_remove_item_when_quantity_gt_1
event_store = Rails.configuration.event_store

Expand Down
6 changes: 0 additions & 6 deletions rails_application/test/orders/order_cancelled_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ module Orders
class OrderCancelledTest < InMemoryTestCase
cover "Orders*"

def setup
super
Customer.destroy_all
Order.destroy_all
end

def test_cancel_confirmed_order
event_store = Rails.configuration.event_store
customer_id = SecureRandom.uuid
Expand Down
5 changes: 0 additions & 5 deletions rails_application/test/orders/order_expired_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ module Orders
class OrderExpiredTest < InMemoryTestCase
cover "Orders*"

def setup
super
Order.destroy_all
end

def test_expire_created_order
event_store = Rails.configuration.event_store

Expand Down
6 changes: 0 additions & 6 deletions rails_application/test/orders/order_paid_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ module Orders
class OrderConfirmedTest < InMemoryTestCase
cover "Orders*"

def setup
super
Customer.destroy_all
Order.destroy_all
end

def test_order_confirmed
event_store = Rails.configuration.event_store
customer_id = SecureRandom.uuid
Expand Down
6 changes: 0 additions & 6 deletions rails_application/test/orders/order_placed_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ class OrderPlacedTest < InMemoryTestCase
include ActiveJob::TestHelper
cover "Orders"

def setup
super
Order.destroy_all
OrderLine.destroy_all
end

def test_create_when_not_exists
event_store = Rails.configuration.event_store

Expand Down
Loading