Skip to content

Commit

Permalink
dev: rubocop-rspec
Browse files Browse the repository at this point in the history
  • Loading branch information
palkan committed Mar 7, 2023
1 parent 9e2a183 commit a8d89ab
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ require:
inherit_gem:
standard: config/base.yml

inherit_from:
- .rubocop/rubocop_rspec.yml

AllCops:
Exclude:
- 'bin/*'
Expand Down
44 changes: 44 additions & 0 deletions .rubocop/rubocop_rspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
require:
- rubocop-rspec

RSpec:
Enabled: false

RSpec/Focus:
Enabled: true

RSpec/EmptyExampleGroup:
Enabled: true

RSpec/EmptyLineAfterExampleGroup:
Enabled: true

RSpec/EmptyLineAfterFinalLet:
Enabled: true

RSpec/EmptyLineAfterHook:
Enabled: true

RSpec/EmptyLineAfterSubject:
Enabled: true

RSpec/HookArgument:
Enabled: true

RSpec/HooksBeforeExamples:
Enabled: true

RSpec/ImplicitExpect:
Enabled: true

RSpec/IteratedExpectation:
Enabled: true

RSpec/LetBeforeExamples:
Enabled: true

RSpec/MissingExampleGroupArgument:
Enabled: true

RSpec/ReceiveCounts:
Enabled: true
1 change: 1 addition & 0 deletions gemfiles/rubocop.gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
source "https://rubygems.org" do
gem "rubocop-md", "~> 1.0"
gem "standard", "~> 1.0"
gem "rubocop-rspec"
gem "ruby-next", ">= 0.12"
end
6 changes: 4 additions & 2 deletions spec/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def submeta=(val)
end
end

fcontext "with types" do
context "with types" do
let(:conf) do
klass = Class.new(CoolConfig)
klass.coerce_types(port: :string)
Expand Down Expand Up @@ -723,7 +723,7 @@ def self.name
end
end

fdescribe ".required" do
describe ".required" do
let(:config) do
Class.new(described_class) do
config_name "testo"
Expand Down Expand Up @@ -864,6 +864,7 @@ def self.name
end

let(:missed_keys) { [:host] }

it_behaves_like "raises ValidationError"
end
end
Expand All @@ -880,6 +881,7 @@ def self.name

context "when env value under except key mismatched" do
before { allow(Anyway::Settings).to receive(:current_environment).and_return("demo") }

let(:missed_keys) { [:sentry_api_key] }

it "raises ValidationError" do
Expand Down
1 change: 1 addition & 0 deletions spec/generators/config_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

describe Anyway::Generators::ConfigGenerator, :rails, type: :generator do
before(:all) { destination File.join(__dir__, "../../tmp/basic_rails_app") }

let(:configs_root) { Anyway::Settings.autoload_static_config_path }

let(:args) { %w[api_service api_key secret mode --no-yml] }
Expand Down
1 change: 1 addition & 0 deletions spec/generators/install_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

describe Anyway::Generators::InstallGenerator, :rails, type: :generator do
before(:all) { destination File.join(__dir__, "../../tmp/basic_rails_app") }

let(:configs_root) { Anyway::Settings.autoload_static_config_path }
let(:args) { [] }

Expand Down
2 changes: 2 additions & 0 deletions spec/rails/loaders/yaml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

context "when known environments enabled" do
before { Anyway::Settings.future.use :unwrap_known_environments }

after do
Rails.env = "test"
Anyway::Settings.future.use []
Expand Down Expand Up @@ -158,6 +159,7 @@

context "when only default environmental key is one of environments" do
let(:options) { {config_path: Rails.root.join("config/cool_unmatched_environment.yml"), some_other: "value"} }

before { Anyway::Settings.default_environmental_key = "production" }

it "loads production as default" do
Expand Down

0 comments on commit a8d89ab

Please sign in to comment.