saucy/test/models/member_test.rb

27 lines
666 B
Ruby
Raw Normal View History

2022-06-25 12:48:46 +00:00
require "test_helper"
class MemberTest < ActiveSupport::TestCase
setup do
@member = Member.create!(
email: 'dsfargeg@example.com',
display_name: 'dsfargeg',
joined_on: Date.today,
expires_on: Date.today + 1.year
)
end
test "no expired in the first year and 90 days" do
(1.year + 90.days).in_days.to_i.times do |n|
Timecop.freeze(Date.today + n.days) do
assert_not_equal @member.expected_status, :cancelled
end
end
end
test "expired after 1 year and 90 days" do
Timecop.freeze(Date.today + 1.year + 90.days) do
assert_equal @member.expected_status, :cancelled
end
end
end