mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-02-18 01:14:48 +00:00
DEV: Bump rubocop-discourse (#136)
This commit is contained in:
parent
c00e539304
commit
c93be7632c
24
Gemfile.lock
24
Gemfile.lock
@ -8,30 +8,32 @@ GEM
|
|||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
ast (2.4.2)
|
ast (2.4.2)
|
||||||
|
json (2.6.2)
|
||||||
parallel (1.22.1)
|
parallel (1.22.1)
|
||||||
parser (3.1.2.0)
|
parser (3.1.2.1)
|
||||||
ast (~> 2.4.1)
|
ast (~> 2.4.1)
|
||||||
rainbow (3.1.1)
|
rainbow (3.1.1)
|
||||||
regexp_parser (2.5.0)
|
regexp_parser (2.6.0)
|
||||||
rexml (3.2.5)
|
rexml (3.2.5)
|
||||||
rubocop (1.30.1)
|
rubocop (1.36.0)
|
||||||
|
json (~> 2.3)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 3.1.0.0)
|
parser (>= 3.1.2.1)
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
regexp_parser (>= 1.8, < 3.0)
|
regexp_parser (>= 1.8, < 3.0)
|
||||||
rexml (>= 3.2.5, < 4.0)
|
rexml (>= 3.2.5, < 4.0)
|
||||||
rubocop-ast (>= 1.18.0, < 2.0)
|
rubocop-ast (>= 1.20.1, < 2.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (>= 1.4.0, < 3.0)
|
unicode-display_width (>= 1.4.0, < 3.0)
|
||||||
rubocop-ast (1.18.0)
|
rubocop-ast (1.21.0)
|
||||||
parser (>= 3.1.1.0)
|
parser (>= 3.1.1.0)
|
||||||
rubocop-discourse (2.5.0)
|
rubocop-discourse (3.0)
|
||||||
rubocop (>= 1.1.0)
|
rubocop (>= 1.1.0)
|
||||||
rubocop-rspec (>= 2.0.0)
|
rubocop-rspec (>= 2.0.0)
|
||||||
rubocop-rspec (2.11.1)
|
rubocop-rspec (2.13.2)
|
||||||
rubocop (~> 1.19)
|
rubocop (~> 1.33)
|
||||||
ruby-progressbar (1.11.0)
|
ruby-progressbar (1.11.0)
|
||||||
unicode-display_width (2.1.0)
|
unicode-display_width (2.3.0)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
@ -41,4 +43,4 @@ DEPENDENCIES
|
|||||||
translations-manager!
|
translations-manager!
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.2.19
|
2.3.4
|
||||||
|
@ -9,7 +9,7 @@ module DiscourseSubscriptions
|
|||||||
expect(DiscourseSubscriptions::Admin::PlansController < ::Admin::AdminController).to eq(true)
|
expect(DiscourseSubscriptions::Admin::PlansController < ::Admin::AdminController).to eq(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'not authenticated' do
|
context 'when not authenticated' do
|
||||||
describe "index" do
|
describe "index" do
|
||||||
it "does not get the plans" do
|
it "does not get the plans" do
|
||||||
::Stripe::Price.expects(:list).never
|
::Stripe::Price.expects(:list).never
|
||||||
@ -54,7 +54,7 @@ module DiscourseSubscriptions
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'authenticated' do
|
context 'when authenticated' do
|
||||||
let(:admin) { Fabricate(:admin) }
|
let(:admin) { Fabricate(:admin) }
|
||||||
|
|
||||||
before { sign_in(admin) }
|
before { sign_in(admin) }
|
||||||
|
@ -9,7 +9,7 @@ module DiscourseSubscriptions
|
|||||||
expect(DiscourseSubscriptions::Admin::ProductsController < ::Admin::AdminController).to eq(true)
|
expect(DiscourseSubscriptions::Admin::ProductsController < ::Admin::AdminController).to eq(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'unauthenticated' do
|
context 'when unauthenticated' do
|
||||||
it "does not list the products" do
|
it "does not list the products" do
|
||||||
::Stripe::Product.expects(:list).never
|
::Stripe::Product.expects(:list).never
|
||||||
get "/s/admin/products.json"
|
get "/s/admin/products.json"
|
||||||
@ -41,7 +41,7 @@ module DiscourseSubscriptions
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'authenticated' do
|
context 'when authenticated' do
|
||||||
let(:admin) { Fabricate(:admin) }
|
let(:admin) { Fabricate(:admin) }
|
||||||
|
|
||||||
before { sign_in(admin) }
|
before { sign_in(admin) }
|
||||||
|
@ -16,7 +16,7 @@ module DiscourseSubscriptions
|
|||||||
Fabricate(:subscription, external_id: "sub_77777", customer_id: customer.id)
|
Fabricate(:subscription, external_id: "sub_77777", customer_id: customer.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'unauthenticated' do
|
context 'when unauthenticated' do
|
||||||
it "does nothing" do
|
it "does nothing" do
|
||||||
::Stripe::Subscription.expects(:list).never
|
::Stripe::Subscription.expects(:list).never
|
||||||
get "/s/admin/subscriptions.json"
|
get "/s/admin/subscriptions.json"
|
||||||
@ -29,7 +29,7 @@ module DiscourseSubscriptions
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'authenticated' do
|
context 'when authenticated' do
|
||||||
let(:admin) { Fabricate(:admin) }
|
let(:admin) { Fabricate(:admin) }
|
||||||
|
|
||||||
before { sign_in(admin) }
|
before { sign_in(admin) }
|
||||||
|
@ -7,7 +7,7 @@ module DiscourseSubscriptions
|
|||||||
let (:user) { Fabricate(:user) }
|
let (:user) { Fabricate(:user) }
|
||||||
let (:campaign_user) { Fabricate(:user) }
|
let (:campaign_user) { Fabricate(:user) }
|
||||||
|
|
||||||
context "showing products" do
|
context "when showing products" do
|
||||||
let(:product) do
|
let(:product) do
|
||||||
{
|
{
|
||||||
id: "prodct_23456",
|
id: "prodct_23456",
|
||||||
@ -80,7 +80,7 @@ module DiscourseSubscriptions
|
|||||||
Fabricate(:customer, product_id: "prodct_23456", user_id: user.id, customer_id: 'x')
|
Fabricate(:customer, product_id: "prodct_23456", user_id: user.id, customer_id: 'x')
|
||||||
Fabricate(:customer, product_id: "prod_campaign", user_id: campaign_user.id, customer_id: 'y')
|
Fabricate(:customer, product_id: "prod_campaign", user_id: campaign_user.id, customer_id: 'y')
|
||||||
end
|
end
|
||||||
context 'not showing contributors' do
|
context 'when not showing contributors' do
|
||||||
it 'returns nothing if not set to show contributors' do
|
it 'returns nothing if not set to show contributors' do
|
||||||
SiteSetting.discourse_subscriptions_campaign_show_contributors = false
|
SiteSetting.discourse_subscriptions_campaign_show_contributors = false
|
||||||
get "/s/contributors.json"
|
get "/s/contributors.json"
|
||||||
@ -90,7 +90,7 @@ module DiscourseSubscriptions
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'showing contributors' do
|
context 'when showing contributors' do
|
||||||
before do
|
before do
|
||||||
SiteSetting.discourse_subscriptions_campaign_show_contributors = true
|
SiteSetting.discourse_subscriptions_campaign_show_contributors = true
|
||||||
end
|
end
|
||||||
@ -140,8 +140,8 @@ module DiscourseSubscriptions
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "creating subscriptions" do
|
context "when creating subscriptions" do
|
||||||
context "unauthenticated" do
|
context "when unauthenticated" do
|
||||||
it "does not create a subscription" do
|
it "does not create a subscription" do
|
||||||
::Stripe::Customer.expects(:create).never
|
::Stripe::Customer.expects(:create).never
|
||||||
::Stripe::Price.expects(:retrieve).never
|
::Stripe::Price.expects(:retrieve).never
|
||||||
@ -150,7 +150,7 @@ module DiscourseSubscriptions
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "authenticated" do
|
context "when authenticated" do
|
||||||
before do
|
before do
|
||||||
sign_in(user)
|
sign_in(user)
|
||||||
end
|
end
|
||||||
@ -225,7 +225,7 @@ module DiscourseSubscriptions
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "with promo code" do
|
context "with promo code" do
|
||||||
context "invalid code" do
|
context "with invalid code" do
|
||||||
it "prevents use of invalid coupon codes" do
|
it "prevents use of invalid coupon codes" do
|
||||||
::Stripe::Price.expects(:retrieve).returns(
|
::Stripe::Price.expects(:retrieve).returns(
|
||||||
type: 'recurring',
|
type: 'recurring',
|
||||||
@ -247,7 +247,7 @@ module DiscourseSubscriptions
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "valid code" do
|
context "with valid code" do
|
||||||
before do
|
before do
|
||||||
::Stripe::PromotionCode.expects(:list).with({ code: '123' }).returns(
|
::Stripe::PromotionCode.expects(:list).with({ code: '123' }).returns(
|
||||||
data: [{
|
data: [{
|
||||||
@ -338,7 +338,7 @@ module DiscourseSubscriptions
|
|||||||
let(:group_name) { 'group-123' }
|
let(:group_name) { 'group-123' }
|
||||||
let(:group) { Fabricate(:group, name: group_name) }
|
let(:group) { Fabricate(:group, name: group_name) }
|
||||||
|
|
||||||
context "unauthorized group" do
|
context "with unauthorized group" do
|
||||||
before do
|
before do
|
||||||
::Stripe::Customer.expects(:create).returns(id: 'cus_1234')
|
::Stripe::Customer.expects(:create).returns(id: 'cus_1234')
|
||||||
::Stripe::Subscription.expects(:create).returns(status: 'active')
|
::Stripe::Subscription.expects(:create).returns(status: 'active')
|
||||||
@ -357,7 +357,7 @@ module DiscourseSubscriptions
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "plan has group in metadata" do
|
context "when plan has group in metadata" do
|
||||||
before do
|
before do
|
||||||
::Stripe::Customer.expects(:create).returns(id: 'cus_1234')
|
::Stripe::Customer.expects(:create).returns(id: 'cus_1234')
|
||||||
::Stripe::Price.expects(:retrieve).returns(type: 'recurring', metadata: { group_name: group_name })
|
::Stripe::Price.expects(:retrieve).returns(type: 'recurring', metadata: { group_name: group_name })
|
||||||
|
@ -8,7 +8,7 @@ module DiscourseSubscriptions
|
|||||||
expect(DiscourseSubscriptions::User::PaymentsController < ::ApplicationController).to eq(true)
|
expect(DiscourseSubscriptions::User::PaymentsController < ::ApplicationController).to eq(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
context "not authenticated" do
|
context "when not authenticated" do
|
||||||
it "does not get the payment intents" do
|
it "does not get the payment intents" do
|
||||||
::Stripe::PaymentIntent.expects(:list).never
|
::Stripe::PaymentIntent.expects(:list).never
|
||||||
get "/s/user/payments.json"
|
get "/s/user/payments.json"
|
||||||
@ -16,7 +16,7 @@ module DiscourseSubscriptions
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "authenticated" do
|
context "when authenticated" do
|
||||||
let(:user) { Fabricate(:user, email: 'zasch@example.com') }
|
let(:user) { Fabricate(:user, email: 'zasch@example.com') }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
@ -8,7 +8,7 @@ module DiscourseSubscriptions
|
|||||||
expect(DiscourseSubscriptions::User::SubscriptionsController < ::ApplicationController).to eq(true)
|
expect(DiscourseSubscriptions::User::SubscriptionsController < ::ApplicationController).to eq(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
context "not authenticated" do
|
context "when not authenticated" do
|
||||||
it "does not get the subscriptions" do
|
it "does not get the subscriptions" do
|
||||||
::Stripe::Customer.expects(:list).never
|
::Stripe::Customer.expects(:list).never
|
||||||
get "/s/user/subscriptions.json"
|
get "/s/user/subscriptions.json"
|
||||||
@ -26,7 +26,7 @@ module DiscourseSubscriptions
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "authenticated" do
|
context "when authenticated" do
|
||||||
let(:user) { Fabricate(:user, email: 'beanie@example.com') }
|
let(:user) { Fabricate(:user, email: 'beanie@example.com') }
|
||||||
let(:customer) { Fabricate(:customer, user_id: user.id, customer_id: "cus_23456", product_id: "prod_123") }
|
let(:customer) { Fabricate(:customer, user_id: user.id, customer_id: "cus_23456", product_id: "prod_123") }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user