Skip to content

Instantly share code, notes, and snippets.

@datapimp
Created December 8, 2010 09:36
Show Gist options
  • Save datapimp/733087 to your computer and use it in GitHub Desktop.
Save datapimp/733087 to your computer and use it in GitHub Desktop.
describe "the fee structure" do
describe "for a private group with 2 attendees collecting 1000.00 total" do
create_group_with_attendees(:all,:confirmed_attendees => true, :attendee_count => 2, :group_attributes => {:amount=>1000.00,:amount_type=>"total"})
it "should have a total amount of 1000.00" do
@group.amount.should == 1000.00
end
it "should have a paying attendee count" do
@group.paying_attendee_count.should == 3
end
it "should define a flat fee" do
@group.flat_fee.should > 0.0
end
it "should define a percent fee" do
@group.factor.should < 1.0
end
it "should have a per user cost" do
@group.share_per_person.should be_within(0.1).of(333.33)
end
it "should expose the group fee" do
@group.fee_per_person.should be_within(0.1).of(11.92)
end
it "should calculate a cost per person include the fees" do
@group.cost_per_person.should be_within(0.1).of(345.25)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment