DEV: Bump rubocop-discourse (#136)

This commit is contained in:
David Taylor 2022-10-04 09:18:34 +01:00 committed by GitHub
parent c00e539304
commit c93be7632c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 31 deletions

View File

@ -8,30 +8,32 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
json (2.6.2)
parallel (1.22.1)
parser (3.1.2.0)
parser (3.1.2.1)
ast (~> 2.4.1)
rainbow (3.1.1)
regexp_parser (2.5.0)
regexp_parser (2.6.0)
rexml (3.2.5)
rubocop (1.30.1)
rubocop (1.36.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.0.0)
parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.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)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.18.0)
rubocop-ast (1.21.0)
parser (>= 3.1.1.0)
rubocop-discourse (2.5.0)
rubocop-discourse (3.0)
rubocop (>= 1.1.0)
rubocop-rspec (>= 2.0.0)
rubocop-rspec (2.11.1)
rubocop (~> 1.19)
rubocop-rspec (2.13.2)
rubocop (~> 1.33)
ruby-progressbar (1.11.0)
unicode-display_width (2.1.0)
unicode-display_width (2.3.0)
PLATFORMS
ruby
@ -41,4 +43,4 @@ DEPENDENCIES
translations-manager!
BUNDLED WITH
2.2.19
2.3.4

View File

@ -9,7 +9,7 @@ module DiscourseSubscriptions
expect(DiscourseSubscriptions::Admin::PlansController < ::Admin::AdminController).to eq(true)
end
context 'not authenticated' do
context 'when not authenticated' do
describe "index" do
it "does not get the plans" do
::Stripe::Price.expects(:list).never
@ -54,7 +54,7 @@ module DiscourseSubscriptions
end
end
context 'authenticated' do
context 'when authenticated' do
let(:admin) { Fabricate(:admin) }
before { sign_in(admin) }

View File

@ -9,7 +9,7 @@ module DiscourseSubscriptions
expect(DiscourseSubscriptions::Admin::ProductsController < ::Admin::AdminController).to eq(true)
end
context 'unauthenticated' do
context 'when unauthenticated' do
it "does not list the products" do
::Stripe::Product.expects(:list).never
get "/s/admin/products.json"
@ -41,7 +41,7 @@ module DiscourseSubscriptions
end
end
context 'authenticated' do
context 'when authenticated' do
let(:admin) { Fabricate(:admin) }
before { sign_in(admin) }

View File

@ -16,7 +16,7 @@ module DiscourseSubscriptions
Fabricate(:subscription, external_id: "sub_77777", customer_id: customer.id)
end
context 'unauthenticated' do
context 'when unauthenticated' do
it "does nothing" do
::Stripe::Subscription.expects(:list).never
get "/s/admin/subscriptions.json"
@ -29,7 +29,7 @@ module DiscourseSubscriptions
end
end
context 'authenticated' do
context 'when authenticated' do
let(:admin) { Fabricate(:admin) }
before { sign_in(admin) }

View File

@ -7,7 +7,7 @@ module DiscourseSubscriptions
let (:user) { Fabricate(:user) }
let (:campaign_user) { Fabricate(:user) }
context "showing products" do
context "when showing products" do
let(:product) do
{
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: "prod_campaign", user_id: campaign_user.id, customer_id: 'y')
end
context 'not showing contributors' do
context 'when not showing contributors' do
it 'returns nothing if not set to show contributors' do
SiteSetting.discourse_subscriptions_campaign_show_contributors = false
get "/s/contributors.json"
@ -90,7 +90,7 @@ module DiscourseSubscriptions
end
end
context 'showing contributors' do
context 'when showing contributors' do
before do
SiteSetting.discourse_subscriptions_campaign_show_contributors = true
end
@ -140,8 +140,8 @@ module DiscourseSubscriptions
end
end
context "creating subscriptions" do
context "unauthenticated" do
context "when creating subscriptions" do
context "when unauthenticated" do
it "does not create a subscription" do
::Stripe::Customer.expects(:create).never
::Stripe::Price.expects(:retrieve).never
@ -150,7 +150,7 @@ module DiscourseSubscriptions
end
end
context "authenticated" do
context "when authenticated" do
before do
sign_in(user)
end
@ -225,7 +225,7 @@ module DiscourseSubscriptions
end
context "with promo code" do
context "invalid code" do
context "with invalid code" do
it "prevents use of invalid coupon codes" do
::Stripe::Price.expects(:retrieve).returns(
type: 'recurring',
@ -247,7 +247,7 @@ module DiscourseSubscriptions
end
end
context "valid code" do
context "with valid code" do
before do
::Stripe::PromotionCode.expects(:list).with({ code: '123' }).returns(
data: [{
@ -338,7 +338,7 @@ module DiscourseSubscriptions
let(:group_name) { 'group-123' }
let(:group) { Fabricate(:group, name: group_name) }
context "unauthorized group" do
context "with unauthorized group" do
before do
::Stripe::Customer.expects(:create).returns(id: 'cus_1234')
::Stripe::Subscription.expects(:create).returns(status: 'active')
@ -357,7 +357,7 @@ module DiscourseSubscriptions
end
end
context "plan has group in metadata" do
context "when plan has group in metadata" do
before do
::Stripe::Customer.expects(:create).returns(id: 'cus_1234')
::Stripe::Price.expects(:retrieve).returns(type: 'recurring', metadata: { group_name: group_name })

View File

@ -8,7 +8,7 @@ module DiscourseSubscriptions
expect(DiscourseSubscriptions::User::PaymentsController < ::ApplicationController).to eq(true)
end
context "not authenticated" do
context "when not authenticated" do
it "does not get the payment intents" do
::Stripe::PaymentIntent.expects(:list).never
get "/s/user/payments.json"
@ -16,7 +16,7 @@ module DiscourseSubscriptions
end
end
context "authenticated" do
context "when authenticated" do
let(:user) { Fabricate(:user, email: 'zasch@example.com') }
before do

View File

@ -8,7 +8,7 @@ module DiscourseSubscriptions
expect(DiscourseSubscriptions::User::SubscriptionsController < ::ApplicationController).to eq(true)
end
context "not authenticated" do
context "when not authenticated" do
it "does not get the subscriptions" do
::Stripe::Customer.expects(:list).never
get "/s/user/subscriptions.json"
@ -26,7 +26,7 @@ module DiscourseSubscriptions
end
end
context "authenticated" do
context "when authenticated" do
let(:user) { Fabricate(:user, email: 'beanie@example.com') }
let(:customer) { Fabricate(:customer, user_id: user.id, customer_id: "cus_23456", product_id: "prod_123") }