Skip to content

Commit f067b85

Browse files
Disable cops in place for Ruby 1.8.7 support
1 parent 1c4ac1f commit f067b85

File tree

74 files changed

+352
-341
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+352
-341
lines changed

.rubocop.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,14 @@ Metrics/ModuleLength:
4848
Exclude:
4949
- spec/**/*
5050

51+
# Override the shared base defaults that are in place for 1.8.7 support
52+
53+
Layout/DotPosition:
54+
EnforcedStyle: leading
55+
56+
Style/HashSyntax:
57+
EnforcedStyle: ruby19
58+
59+
Style/Lambda:
60+
Enabled: true
61+

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ gemspec
44

55
eval_gemfile 'Gemfile-rspec-dependencies'
66

7-
gem 'yard', '~> 0.9.24', :require => false
7+
gem 'yard', '~> 0.9.24', require: false
88

99
group :documentation do
1010
gem 'github-markup', '~> 3.0.3'
11-
gem 'redcarpet', '~> 3.5.1', :platforms => [:ruby]
11+
gem 'redcarpet', '~> 3.5.1', platforms: [:ruby]
1212
gem 'relish', '~> 0.7.1'
1313
end
1414

Rakefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ end
9494

9595
namespace :smoke do
9696
desc "create a new example app with generated specs and run them"
97-
task :app => ["clobber:app", "generate:app", "generate:stuff", :smoke]
97+
task app: ["clobber:app", "generate:app", "generate:stuff", :smoke]
9898
end
9999

100100
desc 'clobber generated files'
@@ -132,12 +132,12 @@ namespace :no_active_record do
132132
desc "run a variety of specs against a non-ActiveRecord generated app"
133133
task :smoke do
134134
in_example_app "LOCATION='../../example_app_generator/run_specs.rb' bin/rake #{rails_template_command} --backtrace",
135-
:app_dir => example_app_dir
135+
app_dir: example_app_dir
136136
end
137137

138138
namespace :smoke do
139139
desc "create a new example app without active record including generated specs and run them"
140-
task :app => [
140+
task app: [
141141
"no_active_record:clobber",
142142
"no_active_record:generate:app",
143143
"no_active_record:generate:stuff",
@@ -162,7 +162,7 @@ namespace :no_active_record do
162162
"--skip-sprockets --skip-git --skip-test-unit --skip-listen --skip-bundle --skip-spring " \
163163
"--template=example_app_generator/generate_app.rb"
164164

165-
in_example_app(:app_dir => example_app_dir) do
165+
in_example_app(app_dir: example_app_dir) do
166166
sh "./ci_retry_bundle_install.sh 2>&1"
167167
# Rails 4+ cannot use a `rails` binstub generated by Bundler
168168
sh "bundle binstubs bundler rspec-core rake --force"
@@ -183,14 +183,14 @@ namespace :no_active_record do
183183

184184
desc "generate a bunch of stuff with generators"
185185
task :stuff do
186-
in_example_app "bin/rake #{rails_template_command} LOCATION='../../example_app_generator/generate_stuff.rb'", :app_dir => example_app_dir
186+
in_example_app "bin/rake #{rails_template_command} LOCATION='../../example_app_generator/generate_stuff.rb'", app_dir: example_app_dir
187187
end
188188
end
189189
end
190190

191-
task :acceptance => ['smoke:app', 'no_active_record:smoke:app', :cucumber]
191+
task acceptance: ['smoke:app', 'no_active_record:smoke:app', :cucumber]
192192

193-
task :default => [:spec, :acceptance]
193+
task default: [:spec, :acceptance]
194194

195195
task :verify_private_key_present do
196196
private_key = File.expand_path('~/.gem/rspec-gem-private_key.pem')
@@ -199,4 +199,4 @@ task :verify_private_key_present do
199199
end
200200
end
201201

202-
task :build => :verify_private_key_present
202+
task build: :verify_private_key_present

example_app_generator/generate_stuff.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ def using_source_path(path)
129129

130130
file "app/views/things/custom_action.html.erb",
131131
"This is a template for a custom action.",
132-
:force => true
132+
force: true
133133

134134
file "app/views/errors/401.html.erb",
135135
"This is a template for rendering an error page",
136-
:force => true
136+
force: true
137137

138138
# Use the absolute path so we can load it without active record too
139139
apply File.join(DEFAULT_SOURCE_PATH, 'generate_action_mailer_specs.rb')

example_app_generator/no_active_record/lib/rails/generators/in_memory/model/model_generator.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ class ModelGenerator < ::Rspec::Generators::Base
88

99
desc "Creates a Fake ActiveRecord acting model"
1010
argument :attributes,
11-
:type => :array,
12-
:default => [],
13-
:banner => "field:type field:type"
11+
type: :array,
12+
default: [],
13+
banner: "field:type field:type"
1414

1515
check_class_collision
1616

1717
class_option :parent,
18-
:type => :string,
19-
:desc => "The parent class for the generated model"
18+
type: :string,
19+
desc: "The parent class for the generated model"
2020

2121
def create_model_file
2222
template "model.rb.erb",

example_app_generator/no_active_record/spec/verify_fixture_file_upload_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'rails_helper'
22

3-
RSpec.describe 'Example App', :use_fixtures, :type => :model do
3+
RSpec.describe 'Example App', :use_fixtures, type: :model do
44
it 'supports fixture file upload' do
55
file = fixture_file_upload(__FILE__)
66
expect(file.read).to match(/RSpec\.describe 'Example App'/im)

example_app_generator/no_active_record/spec/verify_no_fixture_setup_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module TestFixtures
1515

1616
require 'rails_helper'
1717

18-
RSpec.describe 'Example App', :use_fixtures, :type => :model do
18+
RSpec.describe 'Example App', :use_fixtures, type: :model do
1919
it "does not set up fixtures" do
2020
expect(defined?(fixtures)).not_to be
2121
end

example_app_generator/spec/verify_custom_renderers_spec.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
require 'rails_helper'
22

3-
RSpec.describe "template rendering", :type => :controller do
3+
RSpec.describe "template rendering", type: :controller do
44
context "without render_views" do
55
context "with the standard renderers" do
66
controller do
77
def index
8-
render :template => 'foo', :layout => false
8+
render template: 'foo', layout: false
99
end
1010
end
1111

@@ -27,7 +27,7 @@ def index
2727
def index
2828
prepend_view_path('app/views/some_templates')
2929

30-
render :template => 'bar', :layout => false
30+
render template: 'bar', layout: false
3131
end
3232
end
3333

@@ -37,7 +37,7 @@ def index
3737
expect(response).to render_template(:bar)
3838
end
3939

40-
it "renders an empty string", :skip => Rails::VERSION::STRING.to_f >= 6.0 do
40+
it "renders an empty string", skip: Rails::VERSION::STRING.to_f >= 6.0 do
4141
get :index
4242

4343
expect(response.body).to eq("")
@@ -49,7 +49,7 @@ def index
4949
def index
5050
prepend_view_path(MyResolver.new)
5151

52-
render :template => 'baz', :layout => false
52+
render template: 'baz', layout: false
5353
end
5454
end
5555

@@ -73,7 +73,7 @@ def index
7373
context "with the standard renderers" do
7474
controller do
7575
def index
76-
render :template => 'foo', :layout => false
76+
render template: 'foo', layout: false
7777
end
7878
end
7979

@@ -95,7 +95,7 @@ def index
9595
def index
9696
prepend_view_path('app/views/some_templates')
9797

98-
render :template => 'bar', :layout => false
98+
render template: 'bar', layout: false
9999
end
100100
end
101101

@@ -117,7 +117,7 @@ def index
117117
def index
118118
prepend_view_path(MyResolver.new)
119119

120-
render :template => 'baz', :layout => false
120+
render template: 'baz', layout: false
121121
end
122122
end
123123

@@ -151,9 +151,9 @@ def find_template(name, path)
151151
"",
152152
name,
153153
->(template, _source = nil) { %("Dynamic template with path '#{template.virtual_path}'") },
154-
:virtual_path => path,
155-
:format => :html,
156-
:locals => []
154+
virtual_path: path,
155+
format: :html,
156+
locals: []
157157
)
158158
end
159159
end

example_app_generator/spec/verify_mailer_preview_path_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def as_commandline(ops)
1616
end
1717

1818
def capture_exec(*ops)
19-
ops << { :err => [:child, :out] }
19+
ops << { err: [:child, :out] }
2020
io = IO.popen(ops)
2121
# Necessary to ignore warnings from Rails code base
2222
out = io.readlines
@@ -28,7 +28,7 @@ def capture_exec(*ops)
2828
end
2929

3030
def have_no_preview
31-
have_attributes(:io => be_blank, :exit_status => 0)
31+
have_attributes(io: be_blank, exit_status: 0)
3232
end
3333

3434
let(:exec_script) {

lib/generators/rspec/controller/controller_generator.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ module Rspec
44
module Generators
55
# @private
66
class ControllerGenerator < Base
7-
argument :actions, :type => :array, :default => [], :banner => "action action"
7+
argument :actions, type: :array, default: [], banner: "action action"
88

9-
class_option :template_engine, :desc => "Template engine to generate view files"
10-
class_option :request_specs, :type => :boolean, :default => true, :desc => "Generate request specs"
11-
class_option :controller_specs, :type => :boolean, :default => false, :desc => "Generate controller specs"
12-
class_option :view_specs, :type => :boolean, :default => true, :desc => "Generate view specs"
13-
class_option :routing_specs, :type => :boolean, :default => false, :desc => "Generate routing specs"
9+
class_option :template_engine, desc: "Template engine to generate view files"
10+
class_option :request_specs, type: :boolean, default: true, desc: "Generate request specs"
11+
class_option :controller_specs, type: :boolean, default: false, desc: "Generate controller specs"
12+
class_option :view_specs, type: :boolean, default: true, desc: "Generate view specs"
13+
class_option :routing_specs, type: :boolean, default: false, desc: "Generate routing specs"
1414

1515
def generate_request_spec
1616
return unless options[:request_specs]

lib/generators/rspec/feature/feature_generator.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ module Rspec
44
module Generators
55
# @private
66
class FeatureGenerator < Base
7-
class_option :feature_specs, :type => :boolean, :default => true, :desc => "Generate feature specs"
8-
class_option :singularize, :type => :boolean, :default => false, :desc => "Singularize the generated feature"
7+
class_option :feature_specs, type: :boolean, default: true, desc: "Generate feature specs"
8+
class_option :singularize, type: :boolean, default: false, desc: "Singularize the generated feature"
99

1010
def generate_feature_spec
1111
return unless options[:feature_specs]

lib/generators/rspec/generator/generator_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Rspec
44
module Generators
55
# @private
66
class GeneratorGenerator < Base
7-
class_option :generator_specs, :type => :boolean, :default => true, :desc => "Generate generator specs"
7+
class_option :generator_specs, type: :boolean, default: true, desc: "Generate generator specs"
88

99
def generate_generator_spec
1010
return unless options[:generator_specs]

lib/generators/rspec/helper/helper_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Rspec
44
module Generators
55
# @private
66
class HelperGenerator < Base
7-
class_option :helper_specs, :type => :boolean, :default => true
7+
class_option :helper_specs, type: :boolean, default: true
88

99
def generate_helper_spec
1010
return unless options[:helper_specs]

lib/generators/rspec/install/install_generator.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def copy_rails_files
3232

3333
def generate_rspec_init(tmpdir)
3434
initializer = ::RSpec::Core::ProjectInitializer.new(
35-
:destination => tmpdir,
36-
:report_stream => StringIO.new
35+
destination: tmpdir,
36+
report_stream: StringIO.new
3737
)
3838
initializer.run
3939

@@ -47,7 +47,7 @@ def replace_generator_command(spec_helper_path)
4747
gsub_file spec_helper_path,
4848
'rspec --init',
4949
'rails generate rspec:install',
50-
:verbose => false
50+
verbose: false
5151
end
5252

5353
def remove_warnings_configuration(spec_helper_path)
@@ -56,7 +56,7 @@ def remove_warnings_configuration(spec_helper_path)
5656
gsub_file spec_helper_path,
5757
/#{empty_line}(#{comment_line})+\s+config\.warnings = true\n/,
5858
'',
59-
:verbose => false
59+
verbose: false
6060
end
6161
end
6262
end

lib/generators/rspec/integration/integration_generator.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ class IntegrationGenerator < Base
77
# Add a deprecation for this class, before rspec-rails 4, to use the
88
# `RequestGenerator` instead
99
class_option :request_specs,
10-
:type => :boolean,
11-
:default => true,
12-
:desc => "Generate request specs"
10+
type: :boolean,
11+
default: true,
12+
desc: "Generate request specs"
1313

1414
def generate_request_spec
1515
return unless options[:request_specs]

lib/generators/rspec/mailer/mailer_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Rspec
55
module Generators
66
# @private
77
class MailerGenerator < Base
8-
argument :actions, :type => :array, :default => [], :banner => "method method"
8+
argument :actions, type: :array, default: [], banner: "method method"
99

1010
def generate_mailer_spec
1111
template "mailer_spec.rb", File.join('spec/mailers', class_path, "#{file_name}_spec.rb")

lib/generators/rspec/model/model_generator.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ module Generators
55
# @private
66
class ModelGenerator < Base
77
argument :attributes,
8-
:type => :array,
9-
:default => [],
10-
:banner => "field:type field:type"
11-
class_option :fixture, :type => :boolean
8+
type: :array,
9+
default: [],
10+
banner: "field:type field:type"
11+
class_option :fixture, type: :boolean
1212

1313
def create_model_spec
1414
template_file = File.join(

0 commit comments

Comments
 (0)