Skip to content

Update to ruby 1.9 hash syntax #2643

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

Merged
merged 1 commit into from
Dec 4, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion features/backtrace_filtering.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Feature: backtrace filtering
config.filter_rails_from_backtrace!
end

RSpec.describe "Controller", :type => :controller do
RSpec.describe "Controller", type: :controller do
controller do
def index
raise "Something went wrong."
Expand Down
18 changes: 9 additions & 9 deletions features/channel_specs/channel_spec.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Feature: channel spec

Channel specs are marked by `:type => :channel` or if you have set
Channel specs are marked by `type: :channel` or if you have set
`config.infer_spec_type_from_file_location!` by placing them in `spec/channels`.

A channel spec is a thin wrapper for an `ActionCable::Channel::TestCase`, and includes all
Expand Down Expand Up @@ -37,7 +37,7 @@ Feature: channel spec
"""ruby
require "rails_helper"

RSpec.describe ChatChannel, :type => :channel do
RSpec.describe ChatChannel, type: :channel do
it "successfully subscribes" do
subscribe room_id: 42
expect(subscription).to be_confirmed
Expand All @@ -52,7 +52,7 @@ Feature: channel spec
"""ruby
require "rails_helper"

RSpec.describe ChatChannel, :type => :channel do
RSpec.describe ChatChannel, type: :channel do
it "rejects subscription" do
subscribe room_id: nil
expect(subscription).to be_rejected
Expand All @@ -67,7 +67,7 @@ Feature: channel spec
"""ruby
require "rails_helper"

RSpec.describe ChatChannel, :type => :channel do
RSpec.describe ChatChannel, type: :channel do
it "successfully subscribes" do
subscribe room_id: 42

Expand Down Expand Up @@ -95,7 +95,7 @@ Feature: channel spec
"""ruby
require "rails_helper"

RSpec.describe ApplicationCable::Connection, :type => :channel do
RSpec.describe ApplicationCable::Connection, type: :channel do
it "successfully connects" do
connect "/cable?user_id=323"
expect(connection.user_id).to eq "323"
Expand All @@ -121,7 +121,7 @@ Feature: channel spec
"""ruby
require "rails_helper"

RSpec.describe ApplicationCable::Connection, :type => :channel do
RSpec.describe ApplicationCable::Connection, type: :channel do
it "successfully connects" do
cookies.signed[:user_id] = "324"

Expand Down Expand Up @@ -149,7 +149,7 @@ Feature: channel spec
"""ruby
require "rails_helper"

RSpec.describe ApplicationCable::Connection, :type => :channel do
RSpec.describe ApplicationCable::Connection, type: :channel do
it "successfully connects" do
connect "/cable", headers: { "X-USER-ID" => "325" }
expect(connection.user_id).to eq "325"
Expand All @@ -175,7 +175,7 @@ Feature: channel spec
"""ruby
require "rails_helper"

RSpec.describe ApplicationCable::Connection, :type => :channel do
RSpec.describe ApplicationCable::Connection, type: :channel do
it "rejects connection" do
expect { connect "/cable?user_id=" }.to have_rejected_connection
end
Expand Down Expand Up @@ -204,7 +204,7 @@ Feature: channel spec
"""ruby
require "rails_helper"

RSpec.describe ApplicationCable::Connection, :type => :channel do
RSpec.describe ApplicationCable::Connection, type: :channel do
it "disconnects" do
connect "/cable?user_id=42"
expect { disconnect }.to output(/User 42 disconnected/).to_stdout
Expand Down
2 changes: 1 addition & 1 deletion features/controller_specs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Controller specs are marked by `:type => :controller` or if you have set
Controller specs are marked by `type: :controller` or if you have set
`config.infer_spec_type_from_file_location!` by placing them in `spec/controllers`.

A controller spec is an RSpec wrapper for a Rails functional test
Expand Down
26 changes: 13 additions & 13 deletions features/controller_specs/anonymous_controller.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Feature: anonymous controller
c.infer_base_class_for_anonymous_controllers = false
end

RSpec.describe BaseController, :type => :controller do
RSpec.describe BaseController, type: :controller do
controller do
def index; end

Expand Down Expand Up @@ -48,7 +48,7 @@ Feature: anonymous controller
end
end

RSpec.describe ApplicationController, :type => :controller do
RSpec.describe ApplicationController, type: :controller do
controller do
def index
raise ApplicationController::AccessDenied
Expand Down Expand Up @@ -83,7 +83,7 @@ Feature: anonymous controller
end
end

RSpec.describe ApplicationController, :type => :controller do
RSpec.describe ApplicationController, type: :controller do
controller do
def index
raise ApplicationController::AccessDenied
Expand Down Expand Up @@ -122,7 +122,7 @@ Feature: anonymous controller
end
end

RSpec.describe FoosController, :type => :controller do
RSpec.describe FoosController, type: :controller do
controller(FoosController) do
def index
raise ApplicationController::AccessDenied
Expand All @@ -149,7 +149,7 @@ Feature: anonymous controller

class FoosController < ApplicationController; end

RSpec.describe FoosController, :type => :controller do
RSpec.describe FoosController, type: :controller do
controller do
def index
render :plain => "Hello World"
Expand All @@ -172,7 +172,7 @@ Feature: anonymous controller
class ApplicationController < ActionController::Base; end
class FoosController < ApplicationController; end

RSpec.describe "Access controller names", :type => :controller do
RSpec.describe "Access controller names", type: :controller do
controller FoosController do
def index
@name = self.class.name
Expand Down Expand Up @@ -211,7 +211,7 @@ Feature: anonymous controller
end
end

RSpec.describe ApplicationController, :type => :controller do
RSpec.describe ApplicationController, type: :controller do
controller do
def index
render :plain => ""
Expand Down Expand Up @@ -239,7 +239,7 @@ Feature: anonymous controller
ExpectedRoutingError = ActionController::RoutingError
end

RSpec.describe ApplicationController, :type => :controller do
RSpec.describe ApplicationController, type: :controller do
controller do
def index
render :plain => "index called"
Expand Down Expand Up @@ -417,7 +417,7 @@ Feature: anonymous controller
"""ruby
require "rails_helper"

RSpec.describe ApplicationController, :type => :controller do
RSpec.describe ApplicationController, type: :controller do
controller do
def custom
render :plain => "custom called"
Expand All @@ -442,7 +442,7 @@ Feature: anonymous controller
class OtherController < ActionController::Base
end

RSpec.describe OtherController, :type => :controller do
RSpec.describe OtherController, type: :controller do
controller do
def custom
render :plain => "custom called"
Expand All @@ -467,7 +467,7 @@ Feature: anonymous controller

class FoosController < ApplicationController; end

RSpec.describe ApplicationController, :type => :controller do
RSpec.describe ApplicationController, type: :controller do
controller FoosController do
def custom
render :plain => "custom called"
Expand Down Expand Up @@ -498,7 +498,7 @@ Feature: anonymous controller
end
end

RSpec.describe Outer::Inner::FoosController, :type => :controller do
RSpec.describe Outer::Inner::FoosController, type: :controller do
controller do
def index
@name = self.class.name
Expand Down Expand Up @@ -535,7 +535,7 @@ Feature: anonymous controller
match "/login" => "sessions#new", :as => "login", :via => "get"
end

RSpec.describe ApplicationController, :type => :controller do
RSpec.describe ApplicationController, type: :controller do
controller do
def index
redirect_to login_url
Expand Down
4 changes: 2 additions & 2 deletions features/controller_specs/bypass_rescue.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Feature: bypass rescue

require 'controllers/gadgets_controller_spec_context'

RSpec.describe GadgetsController, :type => :controller do
RSpec.describe GadgetsController, type: :controller do
before do
def controller.index
raise AccessDenied
Expand All @@ -55,7 +55,7 @@ Feature: bypass rescue

require 'controllers/gadgets_controller_spec_context'

RSpec.describe GadgetsController, :type => :controller do
RSpec.describe GadgetsController, type: :controller do
before do
def controller.index
raise AccessDenied
Expand Down
8 changes: 4 additions & 4 deletions features/controller_specs/controller_spec.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Feature: controller spec
"""ruby
require "rails_helper"

RSpec.describe WidgetsController, :type => :controller do
RSpec.describe WidgetsController, type: :controller do
describe "GET index" do
it "has a 200 status code" do
get :index
Expand All @@ -24,7 +24,7 @@ Feature: controller spec

RSpec.configure {|c| c.before { expect(controller).not_to be_nil }}

RSpec.describe WidgetsController, :type => :controller do
RSpec.describe WidgetsController, type: :controller do
describe "GET index" do
it "doesn't matter" do
end
Expand All @@ -39,7 +39,7 @@ Feature: controller spec
"""ruby
require "rails_helper"

RSpec.describe WidgetsController, :type => :controller do
RSpec.describe WidgetsController, type: :controller do
describe "responds to" do
it "responds to html by default" do
post :create, :params => { :widget => { :name => "Any Name" } }
Expand All @@ -61,7 +61,7 @@ Feature: controller spec
"""ruby
require "rails_helper"

RSpec.describe WidgetsController, :type => :controller do
RSpec.describe WidgetsController, type: :controller do
describe "responds to" do
it "responds to html by default" do
post :create, :params => { :widget => { :name => "Any Name" } }
Expand Down
2 changes: 1 addition & 1 deletion features/controller_specs/cookies.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Feature: Cookies
"""ruby
require "rails_helper"

RSpec.describe ApplicationController, :type => :controller do
RSpec.describe ApplicationController, type: :controller do
controller do
def clear_cookie
cookies.delete(:user_name)
Expand Down
2 changes: 1 addition & 1 deletion features/controller_specs/engine_routes.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Feature: engine routes for controllers
end
end

RSpec.describe MyEngine::WidgetsController, :type => :controller do
RSpec.describe MyEngine::WidgetsController, type: :controller do
routes { MyEngine::Engine.routes }

it "redirects to a random widget" do
Expand Down
8 changes: 4 additions & 4 deletions features/controller_specs/isolation_from_views.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Feature: views are stubbed by default
"""ruby
require "rails_helper"

RSpec.describe WidgetsController, :type => :controller do
RSpec.describe WidgetsController, type: :controller do
describe "index" do
it "renders the index template" do
get :index
Expand All @@ -35,7 +35,7 @@ Feature: views are stubbed by default
"""ruby
require "rails_helper"

RSpec.describe WidgetsController, :type => :controller do
RSpec.describe WidgetsController, type: :controller do
describe "index" do
it "renders the 'new' template" do
get :index
Expand All @@ -52,7 +52,7 @@ Feature: views are stubbed by default
"""ruby
require "rails_helper"

RSpec.describe ThingsController, :type => :controller do
RSpec.describe ThingsController, type: :controller do
describe "custom_action" do
it "renders an empty custom_action template" do
controller.prepend_view_path 'app/views'
Expand Down Expand Up @@ -83,7 +83,7 @@ Feature: views are stubbed by default
"""ruby
require "rails_helper"

RSpec.describe ThingsController, :type => :controller do
RSpec.describe ThingsController, type: :controller do
render_views

it "renders the real custom_action template" do
Expand Down
6 changes: 3 additions & 3 deletions features/controller_specs/render_views.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Feature: render_views
"""ruby
require "rails_helper"

RSpec.describe WidgetsController, :type => :controller do
RSpec.describe WidgetsController, type: :controller do
render_views

describe "GET index" do
Expand All @@ -27,7 +27,7 @@ Feature: render_views
"""ruby
require "rails_helper"

RSpec.describe WidgetsController, :type => :controller do
RSpec.describe WidgetsController, type: :controller do
context "with render_views" do
render_views

Expand Down Expand Up @@ -101,7 +101,7 @@ Feature: render_views
require "rails_helper"
require "support/render_views"

RSpec.describe WidgetsController, :type => :controller do
RSpec.describe WidgetsController, type: :controller do
describe "GET index" do
it "renders the index template" do
get :index
Expand Down
4 changes: 2 additions & 2 deletions features/directory_structure.feature
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Feature: Directory Structure
"""ruby
require "rails_helper"

RSpec.describe WidgetsController, :type => :controller do
RSpec.describe WidgetsController, type: :controller do
it "responds successfully" do
get :index
expect(response.status).to eq(200)
Expand Down Expand Up @@ -205,7 +205,7 @@ Feature: Directory Structure

# Due to limitations in the Rails routing test framework, routes that
# perform redirects must actually be tested via request specs
RSpec.describe "/example", :type => :request do
RSpec.describe "/example", type: :request do
it "redirects to example.com" do
get "/example"
expect(response).to redirect_to("http://example.com")
Expand Down
6 changes: 3 additions & 3 deletions features/feature_specs/feature_spec.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Feature: Feature spec
through an application. They should drive the application only via its external
interface, usually web pages.

Feature specs are marked by `:type => :feature` or if you have set
Feature specs are marked by `type: :feature` or if you have set
`config.infer_spec_type_from_file_location!` by placing them in
`spec/features`.

Expand All @@ -15,15 +15,15 @@ Feature: Feature spec
The `feature` and `scenario` DSL correspond to `describe` and `it`, respectively.
These methods are simply aliases that allow feature specs to read more as
[customer](http://c2.com/cgi/wiki?CustomerTest) and [acceptance](http://c2.com/cgi/wiki?AcceptanceTest) tests. When capybara is required it sets
`:type => :feature` automatically for you.
`type: :feature` automatically for you.

@capybara
Scenario: specify creating a Widget by driving the application with capybara
Given a file named "spec/features/widget_management_spec.rb" with:
"""ruby
require "rails_helper"

RSpec.feature "Widget management", :type => :feature do
RSpec.feature "Widget management", type: :feature do
scenario "User creates a new widget" do
visit "/widgets/new"

Expand Down
Loading