I am having a problem running rspec with this gem. My route is:
Cap::Application.routes.draw do
mount StripeEvent::Engine => '/stripe_events'
I am attempting to run this test:
describe 'customer.created' do
before do
stub_event 'evt_customer_created'
end
it 'is successful' do
post '/stripe_events', id: 'evt_customer_created'
expect(response.code).to eq '200'
# Additional expectations...
end
end
And I have this in my initializer:
StripeEvent.configure do |events|
Clearly you'll be doing something meaningful here...
but we're logging for explanatory purposes.
#
Watch the logs while your tests run:
$ tail -f log/test.log
#
events.subscribe 'customer.created' do |event|
Rails.logger.info '_'
Rails.logger.info event
Rails.logger.info '_'
end
events.all BillingEventLogger.new(Rails.logger)
end
and I get this result:
Failure/Error: post '/stripe_events', id: 'evt_customer_created'
NoMethodError:
undefined method `post' for #RSpec::ExampleGroups::BillingEvents::CustomerCreated:0x0000010cb4f868
I can put anything after the post and get the same result. What am I missing.
Sounds like the post method might not be available in the scope of your tests. If the spec is not under spec/controllers you need to include them (as in include RSpec::Rails::ControllerExampleGroup)
I am having a problem running rspec with this gem. My route is: Cap::Application.routes.draw do
mount StripeEvent::Engine => '/stripe_events'
I am attempting to run this test:
describe 'customer.created' do before do stub_event 'evt_customer_created' end
end
And I have this in my initializer: StripeEvent.configure do |events|
Clearly you'll be doing something meaningful here...
but we're logging for explanatory purposes.
#
Watch the logs while your tests run:
$ tail -f log/test.log
# events.subscribe 'customer.created' do |event| Rails.logger.info '_' Rails.logger.info event Rails.logger.info '_' end
events.all BillingEventLogger.new(Rails.logger) end
and I get this result: Failure/Error: post '/stripe_events', id: 'evt_customer_created' NoMethodError: undefined method `post' for #RSpec::ExampleGroups::BillingEvents::CustomerCreated:0x0000010cb4f868
I can put anything after the post and get the same result. What am I missing.
Don French