discourse-subscriptions/spec/controllers/discourse_donations/charges_controller_spec.rb

31 lines
943 B
Ruby
Raw Normal View History

require 'rails_helper'
2017-03-19 21:08:30 -04:00
require_relative '../../support/dd_helper'
2017-02-23 21:23:11 -05:00
module DiscourseDonations
RSpec.describe ChargesController, type: :controller do
2017-02-23 21:23:11 -05:00
routes { DiscourseDonations::Engine.routes }
2017-03-19 21:08:30 -04:00
before do
SiteSetting.stubs(:discourse_donations_secret_key).returns('secret-key-yo')
2017-04-06 00:22:22 -04:00
SiteSetting.stubs(:discourse_donations_description).returns('charity begins at discourse plugin')
SiteSetting.stubs(:discourse_donations_currency).returns('AUD')
2017-03-19 21:08:30 -04:00
end
it 'responds ok for anonymous users' do
post :create, { email: 'foobar@example.com' }
expect(response).to have_http_status(200)
end
it 'responds ok when the email is empty' do
2017-04-04 19:49:57 -04:00
post :create, { email: '' }
expect(response).to have_http_status(200)
end
it 'responds ok for logged in user' do
current_user = log_in(:coding_horror)
post :create
expect(response).to have_http_status(200)
end
end
end