1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-18 20:59:39 +02:00
Maybe/test/models/subscription_test.rb
Alex Hatzenbuhler bebe7b40d6
Improve rules - add name, allow sorting, improve UI (#2177)
* Add ability to name a rule

* Add sorting by name and date,

* Improve rule page and form design

* Small header tweak

* Improve sorting click areas by including icon

* Fix brakeman

* Use icon helper instead of lucide_icon helper

* Fix double headers with new DialogComponent

* Use updated_at for sorting instead of created_at

* Use copy-plus icon for compound rules

* Remove icons and change IF/THEN/FOR font in edit form

* Use text-secondary on disabled rules

* First pass at redesigning the sorting menu

* New rule list

* Borders instead of shadows

* Apply proper text color to TO in edit form

* Improve dark mode with proper background color classes

* Use border-secondary

* Add touch: true to conditions and actions of a rule, so updated_at works as expected

* Fix db schema

* Change sort direction to be a LinkComponent outside of the form for better sort behavior

* Clean up dropdown design to match figma

* Match tags/categories design

* Fix name text color, add bg-divider background for dividers

* Fix family subscription tests (thanks zach!)
2025-05-13 15:53:13 -04:00

33 lines
705 B
Ruby

require "test_helper"
class SubscriptionTest < ActiveSupport::TestCase
setup do
@family = Family.create!(name: "Test Family")
end
test "can create subscription without stripe details if trial" do
subscription = Subscription.new(
family: @family,
status: :trialing,
)
assert_not subscription.valid?
subscription.trial_ends_at = 14.days.from_now
assert subscription.valid?
end
test "stripe details required for all statuses except trial" do
subscription = Subscription.new(
family: @family,
status: :active,
)
assert_not subscription.valid?
subscription.stripe_id = "test-stripe-id"
assert subscription.valid?
end
end