Spec formatting

This commit is contained in:
Rohan Mitchell
2015-01-09 10:53:24 +11:00
parent 80c507cc66
commit 261dea37e9

View File

@@ -4,10 +4,10 @@ require 'spec_helper'
module OpenFoodNetwork
describe UserBalanceCalculator do
let!(:usr) { create(:user) }
let!(:entrprs) { create(:distributor_enterprise) }
describe "finding the account balance of a user with a hub" do
describe "for a user and enterprise" do
let!(:usr) { create(:user) }
let!(:entrprs) { create(:distributor_enterprise) }
let!(:o1) { create(:order_with_totals_and_distribution, user: usr, distributor: entrprs) } #total=10
let!(:o2) { create(:order_with_totals_and_distribution, user: usr, distributor: entrprs) } #total=10
@@ -21,9 +21,9 @@ module OpenFoodNetwork
it "does not find the balance for other enterprises" do
entrprs2 = create(:distributor_enterprise)
o3 = create(:order_with_totals_and_distribution,
user: usr, distributor: entrprs2) #total=10
user: usr, distributor: entrprs2) #total=10
p3 = create(:payment, order: o3, amount: 10.00)
UserBalanceCalculator.new(usr, entrprs2).balance.to_i.should == 0
UserBalanceCalculator.new(usr, entrprs2).balance.to_i.should == 0
end
it "does not find the balance for other users" do
@@ -31,7 +31,7 @@ module OpenFoodNetwork
o4 = create(:order_with_totals_and_distribution,
user: usr2, distributor: entrprs) #total=10
p3 = create(:payment, order: o4, amount: 20.00)
UserBalanceCalculator.new(usr2, entrprs).balance.to_i.should == 10
UserBalanceCalculator.new(usr2, entrprs).balance.to_i.should == 10
end
end
end