Files
growstuff/spec/models/account_spec.rb
Logan Gingerich 10a8df47a9 Factorygirl to factorybot - fixes #1413 (#1425)
* 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
2017-11-01 15:03:31 +00:00

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