Add payment structure

This commit is contained in:
2015-04-29 10:21:12 +02:00
parent 9d5e3f684c
commit e4e7198af5
8 changed files with 59 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
FactoryGirl.define do
factory :list_payment do
end
end
+21
View File
@@ -0,0 +1,21 @@
require 'spec_helper'
describe ListPayment do
it "does completes a list if amount is equal to the list amount" do
list = create :list, price: 10.22
create :list_payment, amount: 10.22, list: list
list.should be_closed
end
it "does completes a list if amount is greater than the list amount" do
list = create :list, price: 10.22
create :list_payment, amount: 12, list: list
list.should be_closed
end
it "does completes a list if amount is less than the list amount, but total payments on list bigger" do
list = create :list, price: 10.22
create :list_payment, amount: 7, list: list
list.should be_active
create :list_payment, amount: 7, list: list
list.should be_closed
end
end
+1
View File
@@ -106,6 +106,7 @@ RSpec.configure do |config|
config.infer_base_class_for_anonymous_controllers = true
config.filter_run_excluding broken: true
config.render_views = true
config.expect_with(:rspec) { |c| c.syntax = [:expect, :should] }
OmniAuth.config.test_mode = true
OmniAuth.config.add_mock :facebook, {