Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rocket hash #2224

Merged
merged 6 commits into from Dec 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions .rubocop_todo.yml
Expand Up @@ -18,10 +18,6 @@ Metrics/MethodLength:
Style/EachWithObject:
Enabled: false

# ruby 1.8.7 only had support for hash rockets
Style/HashSyntax:
EnforcedStyle: hash_rockets # default: ruby19

# the new lambda syntax was not supported in ruby 1.8.7
Style/Lambda:
Enabled: false
2 changes: 1 addition & 1 deletion Capybara.md
Expand Up @@ -73,5 +73,5 @@ behavior and accepting the risks associated with doing so:

# not recommended!
RSpec.configure do |c|
c.include Capybara::DSL, :file_path => "spec/requests"
c.include Capybara::DSL, file_path: "spec/requests"
end
8 changes: 4 additions & 4 deletions Changelog.md
Expand Up @@ -344,10 +344,10 @@ Enhancements:
* Improve controller and routing spec calls to `routes` by using `yield`
instead of `call`. (Anton Davydov, #1308)
* Add support for `ActiveJob` specs as standard `RSpec::Rails::RailsExampleGoup`s
via both `:type => :job` and inferring type from spec directory `spec/jobs`.
via both `type: :job` and inferring type from spec directory `spec/jobs`.
JonRowe marked this conversation as resolved.
Show resolved Hide resolved
(Gabe Martin-Dempesy, #1361)
* Include `RSpec::Rails::FixtureSupport` into example groups using metadata
`:use_fixtures => true`. (Aaron Kromer, #1372)
`use_fixtures: true`. (Aaron Kromer, #1372)
* Include `rspec:request` generator for generating request specs; this is an
alias of `rspec:integration` (Aaron Kromer, #1378)
* Update `rails_helper` generator with a default check to abort the spec run
Expand Down Expand Up @@ -488,7 +488,7 @@ Enhancements:
Bug Fixes:

* Fix an inconsistency in the generated scaffold specs for a controller. (Andy Waite)
* Ensure `config.before(:all, :type => <type>)` hooks run before groups
* Ensure `config.before(:all, type: <type>)` hooks run before groups
of the given type, even when the type is inferred by the file
location. (Jon Rowe, Myron Marston)
* Switch to parsing params with `Rack::Utils::parse_nested_query` to match Rails.
Expand Down Expand Up @@ -938,7 +938,7 @@ This release is compatible with rails-3.1.0.rc1, but not rails-3.1.0.beta1
* Enhancements
* include ApplicationHelper in helper object in helper specs
* include request spec extensions in files in spec/integration
* include controller spec extensions in groups that use :type => :controller
* include controller spec extensions in groups that use type: :controller
* same for :model, :view, :helper, :mailer, :request, :routing

* Bug fixes
Expand Down
8 changes: 4 additions & 4 deletions Gemfile
Expand Up @@ -7,12 +7,12 @@ gemspec
rspec_dependencies_gemfile = File.expand_path("../Gemfile-rspec-dependencies", __FILE__)
eval_gemfile rspec_dependencies_gemfile

gem 'yard', '~> 0.8.7', :require => false
gem 'yard', '~> 0.8.7', require: false

### deps for rdoc.info
group :documentation do
gem 'redcarpet', '~> 3.4.0', platforms: [:ruby]
gem 'github-markup', '~> 3.0.3'
gem 'redcarpet', '~> 3.4.0', platforms: [:ruby]
gem 'relish', '~> 0.7.1'
end

Expand All @@ -36,8 +36,8 @@ else
end

if MAJOR >= 6
gem 'selenium-webdriver', '~> 3.5', require: false
gem 'sqlite3', '~> 1.4', platforms: [:ruby]
gem 'selenium-webdriver', '~> 3.5', :require => false
else
gem 'sqlite3', '~> 1.3.6', platforms: [:ruby]
end
Expand All @@ -57,7 +57,7 @@ if RUBY_VERSION < '2.4.0'
gem 'minitest', '< 5.12.0'
end

gem 'capybara', '~> 2.13', :require => false
gem 'capybara', '~> 2.13', require: false

if MAJOR < 6
gem 'nokogiri', '1.8.5'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -35,7 +35,7 @@ Use **[`rspec-rails` 1.x][]** for Rails 2.x.
# (requires master-branch versions of all related RSpec libraries)
group :development, :test do
%w[rspec-core rspec-expectations rspec-mocks rspec-rails rspec-support].each do |lib|
gem lib, :git => "https://github.com/rspec/#{lib}.git", :branch => 'master'
gem lib, git: "https://github.com/rspec/#{lib}.git", branch: 'master'
end
end
```
Expand Down
2 changes: 1 addition & 1 deletion features/matchers/have_broadcasted_matcher.feature
Expand Up @@ -104,7 +104,7 @@ Feature: have_broadcasted matcher
"""ruby
require "rails_helper"
RSpec.describe ChatChannel, :type => :channel do
RSpec.describe ChatChannel, type: :channel do
it "successfully subscribes" do
user = User.new(42)
Expand Down
2 changes: 1 addition & 1 deletion features/matchers/have_enqueued_mail_matcher.feature
Expand Up @@ -33,7 +33,7 @@ Feature: have_enqueued_mail matcher
it "matches with enqueued mailer" do
ActiveJob::Base.queue_adapter = :test
expect {
NotificationsMailer.signup.deliver_later(:wait_until => Date.tomorrow.noon)
NotificationsMailer.signup.deliver_later(wait_until: Date.tomorrow.noon)
}.to have_enqueued_mail.at(Date.tomorrow.noon)
end
end
Expand Down
4 changes: 2 additions & 2 deletions features/step_definitions/additional_cli_steps.rb
@@ -1,10 +1,10 @@
begin
require "active_job"
rescue LoadError # rubocop:disable Lint/HandleExceptions
rescue LoadError # rubocop:disable Lint/SuppressedException
end
begin
require "action_cable"
rescue LoadError # rubocop:disable Lint/HandleExceptions
rescue LoadError # rubocop:disable Lint/SuppressedException
JonRowe marked this conversation as resolved.
Show resolved Hide resolved
end

require "rails/version"
Expand Down
10 changes: 5 additions & 5 deletions lib/generators/rspec/controller/controller_generator.rb
Expand Up @@ -4,12 +4,12 @@ module Rspec
module Generators
# @private
class ControllerGenerator < Base
argument :actions, :type => :array, :default => [], :banner => "action action"
argument :actions, type: :array, default: [], banner: "action action"

class_option :template_engine, :desc => "Template engine to generate view files"
class_option :controller_specs, :type => :boolean, :default => true, :desc => "Generate controller specs"
class_option :view_specs, :type => :boolean, :default => true, :desc => "Generate view specs"
class_option :routing_specs, :type => :boolean, :default => false, :desc => "Generate routing specs"
class_option :template_engine, desc: "Template engine to generate view files"
class_option :controller_specs, type: :boolean, default: true, desc: "Generate controller specs"
class_option :view_specs, type: :boolean, default: true, desc: "Generate view specs"
class_option :routing_specs, type: :boolean, default: false, desc: "Generate routing specs"

def generate_controller_spec
return unless options[:controller_specs]
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/rspec/controller/templates/routing_spec.rb
Expand Up @@ -5,7 +5,7 @@
describe 'routing' do
<% for action in actions -%>
it 'routes to #<%= action %>' do
expect(:get => "/<%= class_name.underscore %>/<%= action %>").to route_to("<%= class_name.underscore %>#<%= action %>")
expect(get: "/<%= class_name.underscore %>/<%= action %>").to route_to("<%= class_name.underscore %>#<%= action %>")
end
<% end -%>
end
Expand Down
4 changes: 2 additions & 2 deletions lib/generators/rspec/feature/feature_generator.rb
Expand Up @@ -4,8 +4,8 @@ module Rspec
module Generators
# @private
class FeatureGenerator < Base
class_option :feature_specs, :type => :boolean, :default => true, :desc => "Generate feature specs"
class_option :singularize, :type => :boolean, :default => false, :desc => "Singularize the generated feature"
class_option :feature_specs, type: :boolean, default: true, desc: "Generate feature specs"
class_option :singularize, type: :boolean, default: false, desc: "Singularize the generated feature"

def generate_feature_spec
return unless options[:feature_specs]
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/rspec/generators/generator_generator.rb
Expand Up @@ -4,7 +4,7 @@ module Rspec
module Generators
# @private
class GeneratorsGenerator < Base
class_option :generator_specs, :type => :boolean, :default => false, :desc => "Generate generator specs"
class_option :generator_specs, type: :boolean, default: false, desc: "Generate generator specs"

def generate_generator_spec
return unless options[:generator_specs]
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/rspec/helper/helper_generator.rb
Expand Up @@ -4,7 +4,7 @@ module Rspec
module Generators
# @private
class HelperGenerator < Base
class_option :helper_specs, :type => :boolean, :default => true
class_option :helper_specs, type: :boolean, default: true

def generate_helper_spec
return unless options[:helper_specs]
Expand Down
8 changes: 4 additions & 4 deletions lib/generators/rspec/install/install_generator.rb
Expand Up @@ -32,8 +32,8 @@ def copy_rails_files

def generate_rspec_init(tmpdir)
initializer = ::RSpec::Core::ProjectInitializer.new(
:destination => tmpdir,
:report_stream => StringIO.new
destination: tmpdir,
report_stream: StringIO.new
)
initializer.run

Expand All @@ -47,7 +47,7 @@ def replace_generator_command(spec_helper_path)
gsub_file spec_helper_path,
'rspec --init',
'rails generate rspec:install',
:verbose => false
verbose: false
end

def remove_warnings_configuration(spec_helper_path)
Expand All @@ -56,7 +56,7 @@ def remove_warnings_configuration(spec_helper_path)
gsub_file spec_helper_path,
/#{empty_line}(#{comment_line})+\s+config\.warnings = true\n/,
'',
:verbose => false
verbose: false
end
end
end
Expand Down
Expand Up @@ -63,7 +63,7 @@
# You can disable this behaviour by removing the line below, and instead
# explicitly tag your specs with their type, e.g.:
#
# RSpec.describe UsersController, :type => :controller do
# RSpec.describe UsersController, type: :controller do
# # ...
# end
#
Expand Down
6 changes: 3 additions & 3 deletions lib/generators/rspec/integration/integration_generator.rb
Expand Up @@ -7,9 +7,9 @@ class IntegrationGenerator < Base
# Add a deprecation for this class, before rspec-rails 4, to use the
# `RequestGenerator` instead
class_option :request_specs,
:type => :boolean,
:default => true,
:desc => "Generate request specs"
type: :boolean,
default: true,
desc: "Generate request specs"

def generate_request_spec
return unless options[:request_specs]
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/rspec/mailer/mailer_generator.rb
Expand Up @@ -5,7 +5,7 @@ module Rspec
module Generators
# @private
class MailerGenerator < Base
argument :actions, :type => :array, :default => [], :banner => "method method"
argument :actions, type: :array, default: [], banner: "method method"

def generate_mailer_spec
template "mailer_spec.rb", File.join('spec/mailers', class_path, "#{file_name}_spec.rb")
Expand Down
8 changes: 4 additions & 4 deletions lib/generators/rspec/model/model_generator.rb
Expand Up @@ -5,10 +5,10 @@ module Generators
# @private
class ModelGenerator < Base
argument :attributes,
:type => :array,
:default => [],
:banner => "field:type field:type"
class_option :fixture, :type => :boolean
type: :array,
default: [],
banner: "field:type field:type"
class_option :fixture, type: :boolean

def create_model_spec
template_file = File.join(
Expand Down
20 changes: 10 additions & 10 deletions lib/generators/rspec/scaffold/scaffold_generator.rb
Expand Up @@ -7,17 +7,17 @@ module Generators
class ScaffoldGenerator < Base
include ::Rails::Generators::ResourceHelpers
source_paths << File.expand_path('../helper/templates', __dir__)
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
argument :attributes, type: :array, default: [], banner: "field:type field:type"

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

class_option :controller_specs, :type => :boolean, :default => true, :desc => "Generate controller specs"
class_option :view_specs, :type => :boolean, :default => true, :desc => "Generate view specs"
class_option :helper_specs, :type => :boolean, :default => true, :desc => "Generate helper specs"
class_option :routing_specs, :type => :boolean, :default => true, :desc => "Generate routing specs"
class_option :controller_specs, type: :boolean, default: true, desc: "Generate controller specs"
class_option :view_specs, type: :boolean, default: true, desc: "Generate view specs"
class_option :helper_specs, type: :boolean, default: true, desc: "Generate helper specs"
class_option :routing_specs, type: :boolean, default: true, desc: "Generate routing specs"

def initialize(*args, &blk)
@generator_args = args.first
Expand Down Expand Up @@ -60,7 +60,7 @@ def generate_routing_spec
template 'routing_spec.rb', template_file
end

hook_for :integration_tool, :as => :integration
hook_for :integration_tool, as: :integration

protected

Expand Down
16 changes: 8 additions & 8 deletions lib/generators/rspec/scaffold/templates/api_controller_spec.rb
Expand Up @@ -60,7 +60,7 @@
it "returns a success response" do
<%= file_name %> = <%= class_name %>.create! valid_attributes
<% if RUBY_VERSION < '1.9.3' -%>
get :show, {:id => <%= file_name %>.to_param}, valid_session
get :show, {id: <%= file_name %>.to_param}, valid_session
<% else -%>
get :show, params: {id: <%= file_name %>.to_param}, session: valid_session
<% end -%>
Expand All @@ -73,7 +73,7 @@
it "creates a new <%= class_name %>" do
expect {
<% if RUBY_VERSION < '1.9.3' -%>
post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session
post :create, {<%= ns_file_name %>: valid_attributes}, valid_session
<% else -%>
post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session
<% end -%>
Expand All @@ -82,7 +82,7 @@

it "renders a JSON response with the new <%= ns_file_name %>" do
<% if RUBY_VERSION < '1.9.3' -%>
post :create, {:<%= ns_file_name %> => valid_attributes}, valid_session
post :create, {<%= ns_file_name %>: valid_attributes}, valid_session
<% else %>
post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session
<% end -%>
Expand All @@ -95,7 +95,7 @@
context "with invalid params" do
it "renders a JSON response with errors for the new <%= ns_file_name %>" do
<% if RUBY_VERSION < '1.9.3' -%>
post :create, {:<%= ns_file_name %> => invalid_attributes}, valid_session
post :create, {<%= ns_file_name %>: invalid_attributes}, valid_session
<% else %>
post :create, params: {<%= ns_file_name %>: invalid_attributes}, session: valid_session
<% end -%>
Expand All @@ -114,7 +114,7 @@
it "updates the requested <%= ns_file_name %>" do
<%= file_name %> = <%= class_name %>.create! valid_attributes
<% if RUBY_VERSION < '1.9.3' -%>
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => new_attributes}, valid_session
put :update, {id: <%= file_name %>.to_param, <%= ns_file_name %>: new_attributes}, valid_session
<% else -%>
put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: new_attributes}, session: valid_session
<% end -%>
Expand All @@ -125,7 +125,7 @@
it "renders a JSON response with the <%= ns_file_name %>" do
<%= file_name %> = <%= class_name %>.create! valid_attributes
<% if RUBY_VERSION < '1.9.3' -%>
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => valid_attributes}, valid_session
put :update, {id: <%= file_name %>.to_param, <%= ns_file_name %>: valid_attributes}, valid_session
<% else %>
put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: valid_attributes}, session: valid_session
<% end -%>
Expand All @@ -138,7 +138,7 @@
it "renders a JSON response with errors for the <%= ns_file_name %>" do
<%= file_name %> = <%= class_name %>.create! valid_attributes
<% if RUBY_VERSION < '1.9.3' -%>
put :update, {:id => <%= file_name %>.to_param, :<%= ns_file_name %> => invalid_attributes}, valid_session
put :update, {id: <%= file_name %>.to_param, <%= ns_file_name %>: invalid_attributes}, valid_session
<% else %>
put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: invalid_attributes}, session: valid_session
<% end -%>
Expand All @@ -153,7 +153,7 @@
<%= file_name %> = <%= class_name %>.create! valid_attributes
expect {
<% if RUBY_VERSION < '1.9.3' -%>
delete :destroy, {:id => <%= file_name %>.to_param}, valid_session
delete :destroy, {id: <%= file_name %>.to_param}, valid_session
<% else -%>
delete :destroy, params: {id: <%= file_name %>.to_param}, session: valid_session
<% end -%>
Expand Down