DEV: Update ruby linting (#77)
* DEV: Update ruby linting * Use named subject in specs --------- Co-authored-by: Loïc Guitaut <loic@discourse.org>
This commit is contained in:
parent
ab6dfc0397
commit
cd14d99e00
47
Gemfile.lock
47
Gemfile.lock
|
@ -2,38 +2,51 @@ GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
ast (2.4.2)
|
ast (2.4.2)
|
||||||
json (2.6.2)
|
json (2.6.3)
|
||||||
parallel (1.22.1)
|
language_server-protocol (3.17.0.3)
|
||||||
parser (3.1.2.1)
|
parallel (1.23.0)
|
||||||
|
parser (3.2.2.4)
|
||||||
ast (~> 2.4.1)
|
ast (~> 2.4.1)
|
||||||
prettier_print (1.2.0)
|
racc
|
||||||
|
prettier_print (1.2.1)
|
||||||
|
racc (1.7.3)
|
||||||
rainbow (3.1.1)
|
rainbow (3.1.1)
|
||||||
regexp_parser (2.6.0)
|
regexp_parser (2.8.2)
|
||||||
rexml (3.2.5)
|
rexml (3.2.6)
|
||||||
rubocop (1.36.0)
|
rubocop (1.57.2)
|
||||||
json (~> 2.3)
|
json (~> 2.3)
|
||||||
|
language_server-protocol (>= 3.17.0)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 3.1.2.1)
|
parser (>= 3.2.2.4)
|
||||||
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.20.1, < 2.0)
|
rubocop-ast (>= 1.28.1, < 2.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (>= 1.4.0, < 3.0)
|
unicode-display_width (>= 2.4.0, < 3.0)
|
||||||
rubocop-ast (1.21.0)
|
rubocop-ast (1.30.0)
|
||||||
parser (>= 3.1.1.0)
|
parser (>= 3.2.1.0)
|
||||||
rubocop-discourse (3.0)
|
rubocop-capybara (2.19.0)
|
||||||
|
rubocop (~> 1.41)
|
||||||
|
rubocop-discourse (3.4.1)
|
||||||
rubocop (>= 1.1.0)
|
rubocop (>= 1.1.0)
|
||||||
rubocop-rspec (>= 2.0.0)
|
rubocop-rspec (>= 2.0.0)
|
||||||
rubocop-rspec (2.13.2)
|
rubocop-factory_bot (2.24.0)
|
||||||
rubocop (~> 1.33)
|
rubocop (~> 1.33)
|
||||||
ruby-progressbar (1.11.0)
|
rubocop-rspec (2.25.0)
|
||||||
syntax_tree (5.1.0)
|
rubocop (~> 1.40)
|
||||||
|
rubocop-capybara (~> 2.17)
|
||||||
|
rubocop-factory_bot (~> 2.22)
|
||||||
|
ruby-progressbar (1.13.0)
|
||||||
|
syntax_tree (6.2.0)
|
||||||
prettier_print (>= 1.2.0)
|
prettier_print (>= 1.2.0)
|
||||||
unicode-display_width (2.3.0)
|
unicode-display_width (2.5.0)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
|
arm64-darwin-20
|
||||||
|
arm64-darwin-22
|
||||||
ruby
|
ruby
|
||||||
|
x86_64-linux
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
rubocop-discourse
|
rubocop-discourse
|
||||||
|
|
|
@ -3,18 +3,18 @@
|
||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
RSpec.describe EnableSteamLoginsValidator do
|
RSpec.describe EnableSteamLoginsValidator do
|
||||||
subject { described_class.new }
|
subject(:validator) { described_class.new }
|
||||||
|
|
||||||
describe "#valid_value?" do
|
describe "#valid_value?" do
|
||||||
describe "when steam_web_api_key has not been set" do
|
describe "when steam_web_api_key has not been set" do
|
||||||
it "should return true when value is false" do
|
it "should return true when value is false" do
|
||||||
expect(subject.valid_value?("f")).to eq(true)
|
expect(validator.valid_value?("f")).to eq(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should return false when value is true" do
|
it "should return false when value is true" do
|
||||||
expect(subject.valid_value?("t")).to eq(false)
|
expect(validator.valid_value?("t")).to eq(false)
|
||||||
|
|
||||||
expect(subject.error_message).to eq(
|
expect(validator.error_message).to eq(
|
||||||
I18n.t("site_settings.errors.steam_web_api_key_is_empty"),
|
I18n.t("site_settings.errors.steam_web_api_key_is_empty"),
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -24,11 +24,11 @@ RSpec.describe EnableSteamLoginsValidator do
|
||||||
before { SiteSetting.steam_web_api_key = "somekey" }
|
before { SiteSetting.steam_web_api_key = "somekey" }
|
||||||
|
|
||||||
it "should return true when value is false" do
|
it "should return true when value is false" do
|
||||||
expect(subject.valid_value?("f")).to eq(true)
|
expect(validator.valid_value?("f")).to eq(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should return true when value is true" do
|
it "should return true when value is true" do
|
||||||
expect(subject.valid_value?("t")).to eq(true)
|
expect(validator.valid_value?("t")).to eq(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue