feature/failing-tests
sha 363253a
| Test | File | Duration | Error |
|---|---|---|---|
| Order#cancel! sets cancelled_at timestamp | spec/models/order_spec.rb :48 | 0.0s | undefined method `cancelled_at' for an instance of Order |
|
NoMethodError
undefined method `cancelled_at' for an instance of Order
./spec/models/order_spec.rb:52:in `block (3 levels) in <top (required)>'
|
|||
| CartOptimizer#optimize with discounts applies 5% discount for items over 50 EUR | spec/services/cart_optimizer_spec.rb :27 | 0.01s | expected: 11400 got: 12000 (compared using ==) |
|
RSpec::Expectations::ExpectationNotMetError
expected: 11400
got: 12000
(compared using ==)
./spec/services/cart_optimizer_spec.rb:32:in `block (3 levels) in <top (required)>'
Test Source
27
it "applies 5% discount for items over 50 EUR" do
28
products = create_list(:product, 2, price_cents: 6000)
29
pharmacies = create_list(:pharmacy, 1)
30
result = described_class.new(products, pharmacies).optimize
31
# BUG: optimize doesn't call apply_discounts โ total_cost is sum of raw prices
32
expect(result[:total_cost]).to eq(11400)
33
end
|
|||
| PaymentService#refund! includes a refund transaction ID | spec/services/payment_service_spec.rb :26 | 0.0s | expected `nil.present?` to be truthy, got false |
|
RSpec::Expectations::ExpectationNotMetError
expected `nil.present?` to be truthy, got false
./spec/services/payment_service_spec.rb:30:in `block (3 levels) in <top (required)>'
Test Source
|
|||
| PricingEngine#calculate does not apply volume discount for low stock | spec/services/pricing_engine_spec.rb :5 | 0.0s | expected: 1000 got: 960 (compared using ==) |
|
RSpec::Expectations::ExpectationNotMetError
expected: 1000
got: 960
(compared using ==)
./spec/services/pricing_engine_spec.rb:10:in `block (3 levels) in <top (required)>'
Test Source
5
it "does not apply volume discount for low stock" do
6
product = create(:product, price_cents: 1000, stock: 200)
7
result = described_class.new(product).calculate
8
# BUG: stock is 200 (>= 100) so volume discount IS applied (0.96x)
9
# This expects no discount, but the engine applies 4% off
10
expect(result[:final_price]).to eq(1000)
11
end
|
|||
| File | Line Cov | Branch Cov | Uncovered | Churn (90d) | Risk |
|---|---|---|---|---|---|
|
68.0%
|
42.9% | 8 | 6 | 192 | |
|
83.3%
|
40.0% | 4 | 11 | 184 | |
|
71.4%
|
33.3% | 8 | 6 | 172 | |
|
82.1%
|
37.5% | 5 | 6 | 107 | |
|
100.0%
|
โ | 0 | 1 | 0 | |
|
100.0%
|
โ | 0 | 1 | 0 | |
|
100.0%
|
100.0% | 0 | 1 | 0 | |
|
100.0%
|
โ | 0 | 1 | 0 | |
|
100.0%
|
โ | 0 | 2 | 0 | |
|
100.0%
|
โ | 0 | 1 | 0 | |
|
100.0%
|
100.0% | 0 | 1 | 0 | |
|
100.0%
|
81.8% | 0 | 1 | 0 | |
| Example | File | Duration | Status |
|---|---|---|---|
| OrderItem#subtotal_cents multiplies quantity by unit price | spec/models/order_item_spec.rb :5 | 0.05s | pass |
| InventorySyncJob#perform syncs products for active pharmacy | spec/jobs/inventory_sync_job_spec.rb :13 | 0.03s | pass |
|
Test Source
|
|||
| ShippingCalculator#calculate adds weight surcharge for large orders | spec/services/shipping_calculator_spec.rb :26 | 0.03s | pass |
|
Test Source
26
it "adds weight surcharge for large orders" do
27
small_order = create(:order, total_cents: 2000)
28
7.times { create(:order_item, order: small_order, quantity: 1, unit_price_cents: 200) }
29
small_order.update_column(:total_cents, 2000) # keep below free threshold
30
result = described_class.new(small_order).calculate(method: :standard)
31
expect(result[:cost]).to be > 499
32
end
|
|||
| OrderItem callback recalculates order total on save | spec/models/order_item_spec.rb :13 | 0.02s | pass |
| Order#recalculate_total! sums order item subtotals | spec/models/order_spec.rb :57 | 0.01s | pass |
|
Test Source
|
|||
| InventorySyncJob#perform skips inactive pharmacies | spec/jobs/inventory_sync_job_spec.rb :17 | 0.01s | pass |
| CartOptimizer#optimize with discounts applies 5% discount for items over 50 EUR | spec/services/cart_optimizer_spec.rb :27 | 0.01s | failed |
|
Failure
RSpec::Expectations::ExpectationNotMetError
expected: 11400
got: 12000
(compared using ==)
./spec/services/cart_optimizer_spec.rb:32:in `block (3 levels) in <top (required)>'
Test Source
27
it "applies 5% discount for items over 50 EUR" do
28
products = create_list(:product, 2, price_cents: 6000)
29
pharmacies = create_list(:pharmacy, 1)
30
result = described_class.new(products, pharmacies).optimize
31
# BUG: optimize doesn't call apply_discounts โ total_cost is sum of raw prices
32
expect(result[:total_cost]).to eq(11400)
33
end
|
|||
| CartOptimizer#optimize returns the cheapest pharmacy | spec/services/cart_optimizer_spec.rb :6 | 0.01s | pass |
|
Test Source
6
it "returns the cheapest pharmacy" do
7
# Heavy factory usage
8
products = create_list(:product, 3)
9
pharmacies = create_list(:pharmacy, 2)
11
result = described_class.new(products, pharmacies).optimize
12
expect(result[:pharmacy]).to be_a(Pharmacy)
13
expect(result[:items]).to be_an(Array)
14
end
|
|||
| CartOptimizer#optimize raises when no pharmacies available | spec/services/cart_optimizer_spec.rb :16 | 0.01s | pass |
|
Test Source
|
|||
| Order#ship! ships confirmed orders | spec/models/order_spec.rb :26 | 0.01s | pass |
| Product#reserve! decrements stock | spec/models/product_spec.rb :69 | 0.0s | pass |
| Product scopes .active returns only active products | spec/models/product_spec.rb :32 | 0.0s | pass |
| Product scopes .by_category filters by category | spec/models/product_spec.rb :44 | 0.0s | pass |
| Product scopes .in_stock returns products with stock > 0 | spec/models/product_spec.rb :38 | 0.0s | pass |
| Order#confirm! sets status to confirmed | spec/models/order_spec.rb :18 | 0.0s | pass |
| Order#cancel! sets cancelled_at timestamp | spec/models/order_spec.rb :48 | 0.0s | failed |
|
Failure
NoMethodError
undefined method `cancelled_at' for an instance of Order
./spec/models/order_spec.rb:52:in `block (3 levels) in <top (required)>'
|
|||
| Order#deliver! delivers shipped orders | spec/models/order_spec.rb :40 | 0.0s | pass |
| Product validations requires unique minsan_code | spec/models/product_spec.rb :19 | 0.0s | pass |
| PricingEngine#calculate does not apply volume discount for low stock | spec/services/pricing_engine_spec.rb :5 | 0.0s | failed |
|
Failure
RSpec::Expectations::ExpectationNotMetError
expected: 1000
got: 960
(compared using ==)
./spec/services/pricing_engine_spec.rb:10:in `block (3 levels) in <top (required)>'
Test Source
5
it "does not apply volume discount for low stock" do
6
product = create(:product, price_cents: 1000, stock: 200)
7
result = described_class.new(product).calculate
8
# BUG: stock is 200 (>= 100) so volume discount IS applied (0.96x)
9
# This expects no discount, but the engine applies 4% off
10
expect(result[:final_price]).to eq(1000)
11
end
|
|||
| ShippingCalculator#calculate returns standard shipping cost | spec/services/shipping_calculator_spec.rb :7 | 0.0s | pass |
| File | Coverage | Churn | Risk Score |
|---|---|---|---|
| app/services/payment_service.rb | 68.0% | 6 commits | 192 |