test/callbacks_spec.rb in stripe-rails-1.0.2 vs test/callbacks_spec.rb in stripe-rails-1.1.0
- old
+ new
@@ -3,12 +3,12 @@
describe Stripe::Callbacks do
include Rack::Test::Methods
include CallbackHelpers
let(:app) { Rails.application }
- let(:event) { JSON.parse(File.read File.expand_path('../event.json', __FILE__)) }
- let(:invoice) { JSON.parse(File.read File.expand_path('../invoice.json', __FILE__)) }
+ let(:event) { JSON.parse(File.read File.expand_path('event.json', __dir__)) }
+ let(:invoice) { JSON.parse(File.read File.expand_path('invoice.json', __dir__)) }
let(:content) { event }
let(:observer) { Class.new }
before do
header 'Accept', 'application/json'
@@ -50,9 +50,15 @@
before { run_callback_with(callback) { fail } }
it 'causes the whole webhook to fail' do
->{ subject }.must_raise RuntimeError
end
+ end
+
+ describe 'when run from a Stripe webhook test' do
+ before { event['id'] = 'evt_00000000000000' }
+
+ it { subject } # must_not raise error
end
end
describe 'defined without a bang and raising an exception' do
let(:callback) { :after_invoice_payment_succeeded }
\ No newline at end of file