controller spec runs

This commit is contained in:
Rimian Perkins 2019-09-11 18:32:09 +10:00
parent 109d6fc137
commit 3f90518e18
3 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,8 @@
# frozen_string_literal: true
module ::DiscoursePatrons
class Engine < ::Rails::Engine
engine_name 'discourse-patrons'
isolate_namespace DiscoursePatrons
end
end

View File

@ -4,6 +4,11 @@
enabled_site_setting :discourse_patrons_enabled
after_initialize do
load File.expand_path('../lib/discourse_patrons/engine.rb', __FILE__)
load File.expand_path('../config/routes.rb', __FILE__)
load File.expand_path('../app/controllers/patrons_controller.rb', __FILE__)
Discourse::Application.routes.append do
mount ::DiscoursePatrons::Engine, at: 'patrons'
end
end

View File

@ -5,5 +5,13 @@ require 'rails_helper'
module DiscoursePatrons
RSpec.describe PatronsController, type: :controller do
routes { DiscoursePatrons::Engine.routes }
it 'responds ok for anonymous users' do
post :create, params: {}, format: :json
aggregate_failures do
expect(response).to have_http_status(200)
end
end
end
end