From 0c6b77b93a703e707ed04fa1ccdfe8e4b9691622 Mon Sep 17 00:00:00 2001 From: Rimian Perkins Date: Wed, 15 Feb 2017 13:03:58 +1100 Subject: [PATCH] refactor module name space --- .../{choice => discourse_payments}/choice_controller.rb | 2 +- app/helpers/choice/application_helper.rb | 2 +- config/routes.rb | 2 +- lib/.gitkeep | 0 lib/choice.rb | 4 ++-- lib/choice/engine.rb | 7 ------- lib/discourse-payments/engine.rb | 6 ------ lib/discourse_payments/engine.rb | 6 ++++++ plugin.rb | 6 +++--- .../choice_controller_spec.rb | 6 +++--- 10 files changed, 17 insertions(+), 24 deletions(-) rename app/controllers/{choice => discourse_payments}/choice_controller.rb (96%) delete mode 100644 lib/.gitkeep delete mode 100644 lib/choice/engine.rb delete mode 100644 lib/discourse-payments/engine.rb create mode 100644 lib/discourse_payments/engine.rb rename spec/controllers/{choice => discourse_payments}/choice_controller_spec.rb (71%) diff --git a/app/controllers/choice/choice_controller.rb b/app/controllers/discourse_payments/choice_controller.rb similarity index 96% rename from app/controllers/choice/choice_controller.rb rename to app/controllers/discourse_payments/choice_controller.rb index 235b0f1..5eafca6 100644 --- a/app/controllers/choice/choice_controller.rb +++ b/app/controllers/discourse_payments/choice_controller.rb @@ -1,4 +1,4 @@ -module Choice +module DiscoursePayments class ChoiceController < ApplicationController def index render json: {} diff --git a/app/helpers/choice/application_helper.rb b/app/helpers/choice/application_helper.rb index 3d7be32..012d848 100644 --- a/app/helpers/choice/application_helper.rb +++ b/app/helpers/choice/application_helper.rb @@ -1,5 +1,5 @@ -module Choice +module DiscoursePayments module ApplicationHelper end end diff --git a/config/routes.rb b/config/routes.rb index 5aae86f..1dc5f3d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,4 @@ -Choice::Engine.routes.draw do +DiscoursePayments::Engine.routes.draw do resources :choice, only: [:create] get 'users/:username/payments' => 'choice#show' end diff --git a/lib/.gitkeep b/lib/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/lib/choice.rb b/lib/choice.rb index f22e582..db053b1 100644 --- a/lib/choice.rb +++ b/lib/choice.rb @@ -1,6 +1,6 @@ -require 'choice/engine' +require 'discourse-payments/engine' byebug -module Choice +module DiscoursePayments end diff --git a/lib/choice/engine.rb b/lib/choice/engine.rb deleted file mode 100644 index 4b51f5b..0000000 --- a/lib/choice/engine.rb +++ /dev/null @@ -1,7 +0,0 @@ - -module ::Choice - class Engine < ::Rails::Engine - engine_name 'choice' - isolate_namespace Choice - end -end diff --git a/lib/discourse-payments/engine.rb b/lib/discourse-payments/engine.rb deleted file mode 100644 index d5aa639..0000000 --- a/lib/discourse-payments/engine.rb +++ /dev/null @@ -1,6 +0,0 @@ -module ::Choice - class Engine < ::Rails::Engine - engine_name 'choice' - isolate_namespace Choice - end -end diff --git a/lib/discourse_payments/engine.rb b/lib/discourse_payments/engine.rb new file mode 100644 index 0000000..2770737 --- /dev/null +++ b/lib/discourse_payments/engine.rb @@ -0,0 +1,6 @@ +module ::DiscoursePayments + class Engine < ::Rails::Engine + engine_name 'discourse-payments' + isolate_namespace DiscoursePayments + end +end diff --git a/plugin.rb b/plugin.rb index bd3f56f..f6c6f89 100644 --- a/plugin.rb +++ b/plugin.rb @@ -1,12 +1,12 @@ # name: discourse-payments # about: Integrating Discourse with Stripe -# version: 1.0.1 +# version: 1.1.0 # url: https://github.com/choiceaustralia/discourse-payments gem 'stripe', '1.58.0' -load File.expand_path('../lib/discourse-payments/engine.rb', __FILE__) +load File.expand_path('../lib/discourse_payments/engine.rb', __FILE__) Discourse::Application.routes.prepend do - mount ::Choice::Engine, at: '/' + mount ::DiscoursePayments::Engine, at: '/' end diff --git a/spec/controllers/choice/choice_controller_spec.rb b/spec/controllers/discourse_payments/choice_controller_spec.rb similarity index 71% rename from spec/controllers/choice/choice_controller_spec.rb rename to spec/controllers/discourse_payments/choice_controller_spec.rb index 54f1009..59095d9 100644 --- a/spec/controllers/choice/choice_controller_spec.rb +++ b/spec/controllers/discourse_payments/choice_controller_spec.rb @@ -1,9 +1,9 @@ require 'rails_helper' -module Choice +module DiscoursePayments RSpec.describe ChoiceController, type: :controller do - routes { Choice::Engine.routes } - + routes { DiscoursePayments::Engine.routes } + # it 'responds with ok' do post :create expect(response).to have_http_status(200)