Skip to content

Commit 3cdd775

Browse files
authored
Merge pull request #1 from hmtanbir/update-rocket-hash
Update rocket hash
2 parents a5e23a5 + 2461f9f commit 3cdd775

23 files changed

+71
-71
lines changed

.rubocop_todo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Style/EachWithObject:
2020

2121
# ruby 1.8.7 only had support for hash rockets
2222
Style/HashSyntax:
23-
EnforcedStyle: hash_rockets # default: ruby19
23+
EnforcedStyle: ruby19 # default: ruby19
2424

2525
# the new lambda syntax was not supported in ruby 1.8.7
2626
Style/Lambda:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Use **[`rspec-rails` 1.x][]** for Rails 2.x.
3535
# (requires master-branch versions of all related RSpec libraries)
3636
group :development, :test do
3737
%w[rspec-core rspec-expectations rspec-mocks rspec-rails rspec-support].each do |lib|
38-
gem lib, :git => "https://github.com/rspec/#{lib}.git", :branch => 'master'
38+
gem lib, git: "https://github.com/rspec/#{lib}.git", branch: 'master'
3939
end
4040
end
4141
```

features/step_definitions/additional_cli_steps.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
begin
22
require "active_job"
3-
rescue LoadError # rubocop:disable Lint/HandleExceptions
3+
rescue LoadError # rubocop:disable Lint/SuppressedException
44
end
55
begin
66
require "action_cable"
7-
rescue LoadError # rubocop:disable Lint/HandleExceptions
7+
rescue LoadError # rubocop:disable Lint/SuppressedException
88
end
99

1010
require "rails/version"

lib/generators/rspec/controller/controller_generator.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ 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 :controller_specs, :type => :boolean, :default => true, :desc => "Generate controller specs"
11-
class_option :view_specs, :type => :boolean, :default => true, :desc => "Generate view specs"
12-
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 :controller_specs, type: :boolean, default: true, desc: "Generate controller specs"
11+
class_option :view_specs, type: :boolean, default: true, desc: "Generate view specs"
12+
class_option :routing_specs, type: :boolean, default: false, desc: "Generate routing specs"
1313

1414
def generate_controller_spec
1515
return unless options[:controller_specs]

lib/generators/rspec/controller/templates/routing_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
describe 'routing' do
66
<% for action in actions -%>
77
it 'routes to #<%= action %>' do
8-
expect(:get => "/<%= class_name.underscore %>/<%= action %>").to route_to("<%= class_name.underscore %>#<%= action %>")
8+
expect(get: "/<%= class_name.underscore %>/<%= action %>").to route_to("<%= class_name.underscore %>#<%= action %>")
99
end
1010
<% end -%>
1111
end

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/generators/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 GeneratorsGenerator < Base
7-
class_option :generator_specs, :type => :boolean, :default => false, :desc => "Generate generator specs"
7+
class_option :generator_specs, type: :boolean, default: false, 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/install/templates/spec/rails_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
# You can disable this behaviour by removing the line below, and instead
6464
# explicitly tag your specs with their type, e.g.:
6565
#
66-
# RSpec.describe UsersController, :type => :controller do
66+
# RSpec.describe UsersController, type: :controller do
6767
# # ...
6868
# end
6969
#

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(

lib/generators/rspec/scaffold/scaffold_generator.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ module Generators
77
class ScaffoldGenerator < Base
88
include ::Rails::Generators::ResourceHelpers
99
source_paths << File.expand_path('../helper/templates', __dir__)
10-
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
10+
argument :attributes, type: :array, default: [], banner: "field:type field:type"
1111

12-
class_option :orm, :desc => "ORM used to generate the controller"
13-
class_option :template_engine, :desc => "Template engine to generate view files"
14-
class_option :singleton, :type => :boolean, :desc => "Supply to create a singleton controller"
15-
class_option :api, :type => :boolean, :desc => "Skip specs unnecessary for API-only apps"
12+
class_option :orm, desc: "ORM used to generate the controller"
13+
class_option :template_engine, desc: "Template engine to generate view files"
14+
class_option :singleton, type: :boolean, desc: "Supply to create a singleton controller"
15+
class_option :api, type: :boolean, desc: "Skip specs unnecessary for API-only apps"
1616

17-
class_option :controller_specs, :type => :boolean, :default => true, :desc => "Generate controller specs"
18-
class_option :view_specs, :type => :boolean, :default => true, :desc => "Generate view specs"
19-
class_option :helper_specs, :type => :boolean, :default => true, :desc => "Generate helper specs"
20-
class_option :routing_specs, :type => :boolean, :default => true, :desc => "Generate routing specs"
17+
class_option :controller_specs, type: :boolean, default: true, desc: "Generate controller specs"
18+
class_option :view_specs, type: :boolean, default: true, desc: "Generate view specs"
19+
class_option :helper_specs, type: :boolean, default: true, desc: "Generate helper specs"
20+
class_option :routing_specs, type: :boolean, default: true, desc: "Generate routing specs"
2121

2222
def initialize(*args, &blk)
2323
@generator_args = args.first
@@ -60,7 +60,7 @@ def generate_routing_spec
6060
template 'routing_spec.rb', template_file
6161
end
6262

63-
hook_for :integration_tool, :as => :integration
63+
hook_for :integration_tool, as: :integration
6464

6565
protected
6666

lib/generators/rspec/scaffold/templates/api_controller_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
it "returns a success response" do
6161
<%= file_name %> = <%= class_name %>.create! valid_attributes
6262
<% if RUBY_VERSION < '1.9.3' -%>
63-
get :show, {:id => <%= file_name %>.to_param}, valid_session
63+
get :show, {id: <%= file_name %>.to_param}, valid_session
6464
<% else -%>
6565
get :show, params: {id: <%= file_name %>.to_param}, session: valid_session
6666
<% end -%>
@@ -73,7 +73,7 @@
7373
it "creates a new <%= class_name %>" do
7474
expect {
7575
<% if RUBY_VERSION < '1.9.3' -%>
76-
post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session
76+
post :create, {<%= ns_file_name %>: valid_attributes}, valid_session
7777
<% else -%>
7878
post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session
7979
<% end -%>
@@ -82,7 +82,7 @@
8282
8383
it "renders a JSON response with the new <%= ns_file_name %>" do
8484
<% if RUBY_VERSION < '1.9.3' -%>
85-
post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session
85+
post :create, {<%= ns_file_name %>: valid_attributes}, valid_session
8686
<% else %>
8787
post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session
8888
<% end -%>
@@ -95,7 +95,7 @@
9595
context "with invalid params" do
9696
it "renders a JSON response with errors for the new <%= ns_file_name %>" do
9797
<% if RUBY_VERSION < '1.9.3' -%>
98-
post :create, {:<%= ns_file_name %> => invalid_attributes}, valid_session
98+
post :create, {<%= ns_file_name %>: invalid_attributes}, valid_session
9999
<% else %>
100100
post :create, params: {<%= ns_file_name %>: invalid_attributes}, session: valid_session
101101
<% end -%>
@@ -114,7 +114,7 @@
114114
it "updates the requested <%= ns_file_name %>" do
115115
<%= file_name %> = <%= class_name %>.create! valid_attributes
116116
<% if RUBY_VERSION < '1.9.3' -%>
117-
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => new_attributes}, valid_session
117+
put :update, {id: <%= file_name %>.to_param, <%= ns_file_name %>: new_attributes}, valid_session
118118
<% else -%>
119119
put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: new_attributes}, session: valid_session
120120
<% end -%>
@@ -125,7 +125,7 @@
125125
it "renders a JSON response with the <%= ns_file_name %>" do
126126
<%= file_name %> = <%= class_name %>.create! valid_attributes
127127
<% if RUBY_VERSION < '1.9.3' -%>
128-
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => valid_attributes}, valid_session
128+
put :update, {id: <%= file_name %>.to_param, <%= ns_file_name %>: valid_attributes}, valid_session
129129
<% else %>
130130
put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: valid_attributes}, session: valid_session
131131
<% end -%>
@@ -138,7 +138,7 @@
138138
it "renders a JSON response with errors for the <%= ns_file_name %>" do
139139
<%= file_name %> = <%= class_name %>.create! valid_attributes
140140
<% if RUBY_VERSION < '1.9.3' -%>
141-
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => invalid_attributes}, valid_session
141+
put :update, {id: <%= file_name %>.to_param, <%= ns_file_name %>: invalid_attributes}, valid_session
142142
<% else %>
143143
put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: invalid_attributes}, session: valid_session
144144
<% end -%>
@@ -153,7 +153,7 @@
153153
<%= file_name %> = <%= class_name %>.create! valid_attributes
154154
expect {
155155
<% if RUBY_VERSION < '1.9.3' -%>
156-
delete :destroy, {:id => <%= file_name %>.to_param}, valid_session
156+
delete :destroy, {id: <%= file_name %>.to_param}, valid_session
157157
<% else -%>
158158
delete :destroy, params: {id: <%= file_name %>.to_param}, session: valid_session
159159
<% end -%>

lib/generators/rspec/scaffold/templates/controller_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
it "returns a success response" do
6161
<%= file_name %> = <%= class_name %>.create! valid_attributes
6262
<% if Rails::VERSION::STRING < '5.0' -%>
63-
get :show, {:id => <%= file_name %>.to_param}, valid_session
63+
get :show, {id: <%= file_name %>.to_param}, valid_session
6464
<% else -%>
6565
get :show, params: {id: <%= file_name %>.to_param}, session: valid_session
6666
<% end -%>
@@ -83,7 +83,7 @@
8383
it "returns a success response" do
8484
<%= file_name %> = <%= class_name %>.create! valid_attributes
8585
<% if Rails::VERSION::STRING < '5.0' -%>
86-
get :edit, {:id => <%= file_name %>.to_param}, valid_session
86+
get :edit, {id: <%= file_name %>.to_param}, valid_session
8787
<% else -%>
8888
get :edit, params: {id: <%= file_name %>.to_param}, session: valid_session
8989
<% end -%>
@@ -96,7 +96,7 @@
9696
it "creates a new <%= class_name %>" do
9797
expect {
9898
<% if Rails::VERSION::STRING < '5.0' -%>
99-
post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session
99+
post :create, {<%= ns_file_name %>: valid_attributes}, valid_session
100100
<% else -%>
101101
post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session
102102
<% end -%>
@@ -105,7 +105,7 @@
105105
106106
it "redirects to the created <%= ns_file_name %>" do
107107
<% if Rails::VERSION::STRING < '5.0' -%>
108-
post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session
108+
post :create, {<%= ns_file_name %>: valid_attributes}, valid_session
109109
<% else -%>
110110
post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session
111111
<% end -%>
@@ -116,7 +116,7 @@
116116
context "with invalid params" do
117117
it "returns a success response (i.e. to display the 'new' template)" do
118118
<% if Rails::VERSION::STRING < '5.0' -%>
119-
post :create, {:<%= ns_file_name %> => invalid_attributes}, valid_session
119+
post :create, {<%= ns_file_name %>: invalid_attributes}, valid_session
120120
<% else -%>
121121
post :create, params: {<%= ns_file_name %>: invalid_attributes}, session: valid_session
122122
<% end -%>
@@ -134,7 +134,7 @@
134134
it "updates the requested <%= ns_file_name %>" do
135135
<%= file_name %> = <%= class_name %>.create! valid_attributes
136136
<% if Rails::VERSION::STRING < '5.0' -%>
137-
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => new_attributes}, valid_session
137+
put :update, {id: <%= file_name %>.to_param, <%= ns_file_name %>: new_attributes}, valid_session
138138
<% else -%>
139139
put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: new_attributes}, session: valid_session
140140
<% end -%>
@@ -145,7 +145,7 @@
145145
it "redirects to the <%= ns_file_name %>" do
146146
<%= file_name %> = <%= class_name %>.create! valid_attributes
147147
<% if Rails::VERSION::STRING < '5.0' -%>
148-
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => valid_attributes}, valid_session
148+
put :update, {id: <%= file_name %>.to_param, <%= ns_file_name %>: valid_attributes}, valid_session
149149
<% else -%>
150150
put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: valid_attributes}, session: valid_session
151151
<% end -%>
@@ -157,7 +157,7 @@
157157
it "returns a success response (i.e. to display the 'edit' template)" do
158158
<%= file_name %> = <%= class_name %>.create! valid_attributes
159159
<% if Rails::VERSION::STRING < '5.0' -%>
160-
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => invalid_attributes}, valid_session
160+
put :update, {id: <%= file_name %>.to_param, <%= ns_file_name %>: invalid_attributes}, valid_session
161161
<% else -%>
162162
put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: invalid_attributes}, session: valid_session
163163
<% end -%>
@@ -171,7 +171,7 @@
171171
<%= file_name %> = <%= class_name %>.create! valid_attributes
172172
expect {
173173
<% if Rails::VERSION::STRING < '5.0' -%>
174-
delete :destroy, {:id => <%= file_name %>.to_param}, valid_session
174+
delete :destroy, {id: <%= file_name %>.to_param}, valid_session
175175
<% else -%>
176176
delete :destroy, params: {id: <%= file_name %>.to_param}, session: valid_session
177177
<% end -%>
@@ -181,7 +181,7 @@
181181
it "redirects to the <%= table_name %> list" do
182182
<%= file_name %> = <%= class_name %>.create! valid_attributes
183183
<% if Rails::VERSION::STRING < '5.0' -%>
184-
delete :destroy, {:id => <%= file_name %>.to_param}, valid_session
184+
delete :destroy, {id: <%= file_name %>.to_param}, valid_session
185185
<% else -%>
186186
delete :destroy, params: {id: <%= file_name %>.to_param}, session: valid_session
187187
<% end -%>

lib/generators/rspec/scaffold/templates/edit_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
before(:each) do
66
@<%= ns_file_name %> = assign(:<%= ns_file_name %>, <%= class_name %>.create!(<%= '))' if output_attributes.empty? %>
77
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
8-
:<%= attribute.name %> => <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
8+
<%= attribute.name %>: <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
99
<% end -%>
1010
<%= output_attributes.empty? ? "" : " ))\n" -%>
1111
end

lib/generators/rspec/scaffold/templates/index_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<% [1,2].each_with_index do |id, model_index| -%>
88
<%= class_name %>.create!(<%= output_attributes.empty? ? (model_index == 1 ? ')' : '),') : '' %>
99
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
10-
:<%= attribute.name %> => <%= value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
10+
<%= attribute.name %>: <%= value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
1111
<% end -%>
1212
<% if !output_attributes.empty? -%>
1313
<%= model_index == 1 ? ')' : '),' %>
@@ -19,7 +19,7 @@
1919
it "renders a list of <%= ns_table_name %>" do
2020
render
2121
<% for attribute in output_attributes -%>
22-
assert_select "tr>td", :text => <%= value_for(attribute) %>.to_s, :count => 2
22+
assert_select "tr>td", text: <%= value_for(attribute) %>.to_s, :count => 2
2323
<% end -%>
2424
end
2525
end

lib/generators/rspec/scaffold/templates/new_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
before(:each) do
66
assign(:<%= ns_file_name %>, <%= class_name %>.new(<%= '))' if output_attributes.empty? %>
77
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
8-
:<%= attribute.name %> => <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
8+
<%= attribute.name %>: <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
99
<% end -%>
1010
<%= !output_attributes.empty? ? " ))\n end" : " end" %>
1111

0 commit comments

Comments
 (0)