I am new to testing. I am trying to use stripe-ruby-mock gem with minitest.
In the stripe-ruby-mock docs they describe a dummy example in Rspec that I am trying to translate to minitest:
require 'stripe_mock'
describe MyApp do
let(:stripe_helper) { StripeMock.create_test_helper }
before { StripeMock.start }
after { StripeMock.stop }
it "creates a stripe customer" do
# This doesn't touch stripe's servers nor the internet!
customer = Stripe::Customer.create({
email: 'johnny@appleseed.com',
card: stripe_helper.generate_card_token
})
expect(customer.email).to eq('johnny@appleseed.com')
end
end
My translation to minitest
require 'test_helper'
require 'stripe_mock'
class SuccessfulCustomerCreationTest < ActionDispatch::IntegrationTest
describe 'create customer' do
def stripe_helper
StripeMock.create_test_helper
end
before do
StripeMock.start
end
after do
StripeMock.stop
end
test "creates a stripe customer" do
customer = Stripe::Customer.create({
email: "koko@koko.com",
card: stripe_helper.generate_card_token
})
assert_equal customer.email, "koko@koko.com"
end
end
end
The error
NoMethodError: undefined method `describe' for SuccessfulPurchaseTest:Class
I consulted the minitest docs to make sure describe
wasn't specific to Rspec but it turns out it is also used in minitest. I am guessing the implementation isn't done properly. Any help appreciated.