mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-24 09:43:24 -04:00
* FactoryGirl Changed to FactoryBot file fix changes based on comments received Bundle Update on 2017-10-29 style update to align hash literal added package-lock * indentation fixes with rubocop * name added to contributors
28 lines
893 B
Ruby
28 lines
893 B
Ruby
require 'rails_helper'
|
|
|
|
describe Account do
|
|
let(:member) { FactoryBot.create(:member) }
|
|
|
|
it "auto-creates an account detail record when a member is created" do
|
|
member.account.should be_an_instance_of Account
|
|
end
|
|
|
|
it "won't let you create two account details for the same member" do
|
|
@details = Account.new(member_id: member.id)
|
|
@details.should_not be_valid
|
|
end
|
|
|
|
it "formats the 'paid until' date nicely" do
|
|
member.account.account_type = FactoryBot.create(:account_type)
|
|
member.account.paid_until_string.should eq nil
|
|
|
|
member.account.account_type = FactoryBot.create(:permanent_paid_account_type)
|
|
member.account.paid_until_string.should eq "forever"
|
|
|
|
member.account.account_type = FactoryBot.create(:paid_account_type)
|
|
@time = Time.zone.now
|
|
member.account.paid_until = @time
|
|
member.account.paid_until_string.should eq @time.to_s
|
|
end
|
|
end
|