Add payment structure
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
FactoryGirl.define do
|
||||
factory :list_payment do
|
||||
|
||||
end
|
||||
end
|
||||
@@ -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
|
||||
@@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user