Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Altmann committed Mar 12, 2016
1 parent a926a64 commit 61f0472
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions test/factories/business_transactions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
discount_value_cents 0
quantity_bought 1

factory :business_transaction_from_ngo, traits: [:from_ngo]

trait :incomplete do
shipping_address nil
end
Expand Down Expand Up @@ -65,6 +67,10 @@
association :article, factory: [:article, :with_discount]
end

trait :from_ngo do
association :seller, factory: [:ngo, :paypal_data]
end

trait :pickup do
selected_transport :pickup
end
Expand Down
2 changes: 2 additions & 0 deletions test/factories/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
admin true
end

factory :ngo, traits: [:ngo]

factory :non_german_user do
country Faker::Address.country
end
Expand Down
5 changes: 2 additions & 3 deletions test/objects/fastbill_api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
describe 'methods' do
let(:business_transaction) { BusinessTransaction.new }
let(:db_business_transaction) { FactoryGirl.create :business_transaction }
let(:db_bt_from_ngo) { FactoryGirl.create :business_transaction_from_ngo }
let(:seller) { db_business_transaction.seller }

describe '::fastbill_chain' do
Expand All @@ -18,9 +19,7 @@

describe 'when seller is an NGO' do
it 'should not contact Fastbill' do
seller.ngo = true
seller.save
api = FastbillAPI.new db_business_transaction
api = FastbillAPI.new db_bt_from_ngo
api.fastbill_chain
assert_not_requested :post, 'https://my_email:my_fastbill_api_key@automatic.fastbill.com'\
'/api/1.0/api.php'
Expand Down

0 comments on commit 61f0472

Please sign in to comment.