Sha256: 038abfc9415529e35cba90be907f370e1490ad6ba9becd8630cd363634becd68
Contents?: true
Size: 1.42 KB
Versions: 10
Compression:
Stored size: 1.42 KB
Contents
require 'spec_helper' describe CanceledAccount do subject { CanceledAccount.create() } it { should belong_to(:plan) } it "doesn't populate anything" do subject.name.should be_nil subject.keyword.should be_nil end end describe CanceledAccount, "given an account" do let(:account) { Factory(:account, :billing_email => "billing@example.com") } before do Factory(:membership, :account => account) end subject { CanceledAccount.create(:account => account) } it "populates its name and keyword from the given account" do subject.name.should == account.name subject.keyword.should == account.keyword end it "populates the billing_email from the customer's email from the given account" do subject.billing_email.should_not be_nil subject.billing_email.should == account.customer.email end it "saves the memberships and users as json from the given account" do memberships_json = account.memberships.to_json(:include => { :user => { :only => [:email, :name, :created_at]}}, :only => [:admin, :created_at]) subject.memberships.should == memberships_json JSON.parse(subject.memberships).should be end it "populates the plan from the given account" do subject.plan_id.should == account.plan_id subject.plan.should == account.plan end it "populates the started_at from the given account's creation date" do subject.started_at.should == account.created_at end end
Version data entries
10 entries across 10 versions & 1 rubygems