Skip to content

Commit

Permalink
use fixture for stock
Browse files Browse the repository at this point in the history
  • Loading branch information
jonny5 committed Jun 2, 2024
1 parent 2d82828 commit b73b345
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 1 addition & 3 deletions test/fixtures/stocks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
one:
ticker: MyString
price: 345


two:
ticker: MyString2
price: 123

price: 123
3 changes: 3 additions & 0 deletions test/models/order_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@ class OrderTest < ActiveSupport::TestCase
stock = Stock.create(ticker: "EVG", price: 10.00)
order = Order.create(stock: stock, shares: 5, status: :completed, user: @student)
assert_equal 50, order.purchase_cost
stock = stocks(:one)
order = Order.create(stock:, shares: 5, status: :completed, user: @student)
assert_equal 1725, order.purchase_cost
end
end

0 comments on commit b73b345

Please sign in to comment.