From afa6a7b6661a0d4450d330922c2c930ea2f3ff68 Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Wed, 15 Jun 2016 18:00:51 -0600 Subject: [PATCH] Update RSpec test style across docs Instead of using describe Foo do # ... end use RSpec.describe Foo, type: :model do # ... end instead. This is not exactly official, as the former style still works, but the latter style is highly suggested in RSpec documentation and the like, so this is what people are used to. [ci skip] --- docs/errors/NonCaseSwappableValueError.md | 4 +- .../action_controller/callback_matcher.rb | 12 +-- .../action_controller/filter_param_matcher.rb | 2 +- .../action_controller/permit_matcher.rb | 6 +- .../action_controller/redirect_to_matcher.rb | 2 +- .../render_template_matcher.rb | 2 +- .../render_with_layout_matcher.rb | 4 +- .../action_controller/rescue_from_matcher.rb | 2 +- .../action_controller/respond_with_matcher.rb | 6 +- .../action_controller/route_matcher.rb | 4 +- .../action_controller/set_flash_matcher.rb | 8 +- .../action_controller/set_session_matcher.rb | 6 +- lib/shoulda/matchers/active_model.rb | 2 +- .../allow_mass_assignment_of_matcher.rb | 6 +- .../active_model/allow_value_matcher.rb | 20 ++--- .../have_secure_password_matcher.rb | 2 +- .../validate_absence_of_matcher.rb | 6 +- .../validate_acceptance_of_matcher.rb | 6 +- .../validate_confirmation_of_matcher.rb | 6 +- .../validate_exclusion_of_matcher.rb | 8 +- .../validate_inclusion_of_matcher.rb | 16 ++-- .../validate_length_of_matcher.rb | 16 ++-- .../validate_numericality_of_matcher.rb | 24 +++--- .../validate_presence_of_matcher.rb | 8 +- .../accept_nested_attributes_for_matcher.rb | 8 +- .../active_record/association_matcher.rb | 86 +++++++++---------- .../active_record/define_enum_for_matcher.rb | 4 +- .../active_record/have_db_column_matcher.rb | 6 +- .../active_record/have_db_index_matcher.rb | 6 +- .../have_readonly_attribute_matcher.rb | 2 +- .../active_record/serialize_matcher.rb | 6 +- .../validate_uniqueness_of_matcher.rb | 22 ++--- 32 files changed, 159 insertions(+), 159 deletions(-) diff --git a/docs/errors/NonCaseSwappableValueError.md b/docs/errors/NonCaseSwappableValueError.md index 6939afbd0..08e60d5c2 100644 --- a/docs/errors/NonCaseSwappableValueError.md +++ b/docs/errors/NonCaseSwappableValueError.md @@ -46,7 +46,7 @@ error message explains, you have two options: end # RSpec - describe User do + RSpec.describe User, type: :model do context "validations" do subject do # Note that "123" == "123".swapcase. This is a problem! @@ -87,7 +87,7 @@ error message explains, you have two options: end # RSpec - describe User do + RSpec.describe User, type: :model do context "validations" do subject do # Note that "123" == "123".swapcase, but it's okay diff --git a/lib/shoulda/matchers/action_controller/callback_matcher.rb b/lib/shoulda/matchers/action_controller/callback_matcher.rb index 0861142d8..9569945fe 100644 --- a/lib/shoulda/matchers/action_controller/callback_matcher.rb +++ b/lib/shoulda/matchers/action_controller/callback_matcher.rb @@ -9,7 +9,7 @@ module ActionController # end # # # RSpec - # describe UsersController do + # RSpec.describe UsersController, type: :controller do # it { should use_before_filter(:authenticate_user!) } # it { should_not use_before_filter(:prevent_ssl) } # end @@ -34,7 +34,7 @@ def use_before_filter(callback) # end # # # RSpec - # describe IssuesController do + # RSpec.describe IssuesController, type: :controller do # it { should use_after_filter(:log_activity) } # it { should_not use_after_filter(:destroy_user) } # end @@ -59,7 +59,7 @@ def use_after_filter(callback) # end # # # RSpec - # describe UsersController do + # RSpec.describe UsersController, type: :controller do # it { should use_before_action(:authenticate_user!) } # it { should_not use_before_action(:prevent_ssl) } # end @@ -84,7 +84,7 @@ def use_before_action(callback) # end # # # RSpec - # describe IssuesController do + # RSpec.describe IssuesController, type: :controller do # it { should use_after_action(:log_activity) } # it { should_not use_after_action(:destroy_user) } # end @@ -109,7 +109,7 @@ def use_after_action(callback) # end # # # RSpec - # describe ChangesController do + # RSpec.describe ChangesController, type: :controller do # it { should use_around_filter(:wrap_in_transaction) } # it { should_not use_around_filter(:save_view_context) } # end @@ -134,7 +134,7 @@ def use_around_filter(callback) # end # # # RSpec - # describe ChangesController do + # RSpec.describe ChangesController, type: :controller do # it { should use_around_action(:wrap_in_transaction) } # it { should_not use_around_action(:save_view_context) } # end diff --git a/lib/shoulda/matchers/action_controller/filter_param_matcher.rb b/lib/shoulda/matchers/action_controller/filter_param_matcher.rb index 8817dd078..c8e06b1cb 100644 --- a/lib/shoulda/matchers/action_controller/filter_param_matcher.rb +++ b/lib/shoulda/matchers/action_controller/filter_param_matcher.rb @@ -10,7 +10,7 @@ module ActionController # end # # # RSpec - # describe ApplicationController do + # RSpec.describe ApplicationController, type: :controller do # it { should filter_param(:secret_key) } # end # diff --git a/lib/shoulda/matchers/action_controller/permit_matcher.rb b/lib/shoulda/matchers/action_controller/permit_matcher.rb index ef25fb0d8..5cdbb5c36 100644 --- a/lib/shoulda/matchers/action_controller/permit_matcher.rb +++ b/lib/shoulda/matchers/action_controller/permit_matcher.rb @@ -35,7 +35,7 @@ module ActionController # end # # # RSpec - # describe UsersController do + # RSpec.describe UsersController, type: :controller do # it do # params = { # user: { @@ -96,7 +96,7 @@ module ActionController # end # # # RSpec - # describe UsersController do + # RSpec.describe UsersController, type: :controller do # before do # create(:user, id: 1) # end @@ -170,7 +170,7 @@ module ActionController # end # # # RSpec - # describe UsersController do + # RSpec.describe UsersController, type: :controller do # before do # create(:user, id: 1) # end diff --git a/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb b/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb index 72034832b..8100c45d0 100644 --- a/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +++ b/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb @@ -14,7 +14,7 @@ module ActionController # end # # # RSpec - # describe PostsController do + # RSpec.describe PostsController, type: :controller do # describe 'GET #show' do # before { get :show } # diff --git a/lib/shoulda/matchers/action_controller/render_template_matcher.rb b/lib/shoulda/matchers/action_controller/render_template_matcher.rb index d73e477dc..c373e905f 100644 --- a/lib/shoulda/matchers/action_controller/render_template_matcher.rb +++ b/lib/shoulda/matchers/action_controller/render_template_matcher.rb @@ -15,7 +15,7 @@ module ActionController # <%= render 'sidebar' %> # # # RSpec - # describe PostsController do + # RSpec.describe PostsController, type: :controller do # describe 'GET #show' do # before { get :show } # diff --git a/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb b/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb index 6db46f178..358d210a6 100644 --- a/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb +++ b/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb @@ -11,7 +11,7 @@ module ActionController # end # # # RSpec - # describe PostsController do + # RSpec.describe PostsController, type: :controller do # describe 'GET #show' do # before { get :show } # @@ -38,7 +38,7 @@ module ActionController # end # # # RSpec - # describe PostsController do + # RSpec.describe PostsController, type: :controller do # describe 'GET #sidebar' do # before { get :sidebar } # diff --git a/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb b/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb index 98eb989fd..c791fa1fb 100644 --- a/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb +++ b/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb @@ -16,7 +16,7 @@ module ActionController # end # # # RSpec - # describe ApplicationController do + # RSpec.describe ApplicationController, type: :controller do # it do # should rescue_from(ActiveRecord::RecordNotFound). # with(:handle_not_found) diff --git a/lib/shoulda/matchers/action_controller/respond_with_matcher.rb b/lib/shoulda/matchers/action_controller/respond_with_matcher.rb index 6d15360dc..ef6e1bcd1 100644 --- a/lib/shoulda/matchers/action_controller/respond_with_matcher.rb +++ b/lib/shoulda/matchers/action_controller/respond_with_matcher.rb @@ -13,7 +13,7 @@ module ActionController # end # # # RSpec - # describe PostsController do + # RSpec.describe PostsController, type: :controller do # describe 'GET #index' do # before { get :index } # @@ -39,7 +39,7 @@ module ActionController # end # # # RSpec - # describe PostsController do + # RSpec.describe PostsController, type: :controller do # describe 'DELETE #destroy' do # before { delete :destroy } # @@ -65,7 +65,7 @@ module ActionController # end # # # RSpec - # describe PostsController do + # RSpec.describe PostsController, type: :controller do # describe 'GET #show' do # before { get :show } # diff --git a/lib/shoulda/matchers/action_controller/route_matcher.rb b/lib/shoulda/matchers/action_controller/route_matcher.rb index c615d8459..3dd713a67 100644 --- a/lib/shoulda/matchers/action_controller/route_matcher.rb +++ b/lib/shoulda/matchers/action_controller/route_matcher.rb @@ -24,7 +24,7 @@ module ActionController # end # # # RSpec - # describe PostsController do + # RSpec.describe PostsController, type: :controller do # it { should route(:get, '/posts').to(action: :index) } # it { should route(:get, '/posts/1').to(action: :show, id: 1) } # end @@ -38,7 +38,7 @@ module ActionController # Or you could place the tests along with other route tests: # # # RSpec - # describe 'Routing' do + # describe 'Routing', type: :routing do # it do # should route(:get, '/posts'). # to(controller: :posts, action: :index) diff --git a/lib/shoulda/matchers/action_controller/set_flash_matcher.rb b/lib/shoulda/matchers/action_controller/set_flash_matcher.rb index 3575a8643..10aea10b8 100644 --- a/lib/shoulda/matchers/action_controller/set_flash_matcher.rb +++ b/lib/shoulda/matchers/action_controller/set_flash_matcher.rb @@ -16,7 +16,7 @@ module ActionController # end # # # RSpec - # describe PostsController do + # RSpec.describe PostsController, type: :controller do # describe 'GET #index' do # before { get :index } # @@ -58,7 +58,7 @@ module ActionController # end # # # RSpec - # describe PostsController do + # RSpec.describe PostsController, type: :controller do # describe 'GET #index' do # before { get :index } # @@ -89,7 +89,7 @@ module ActionController # end # # # RSpec - # describe PostsController do + # RSpec.describe PostsController, type: :controller do # describe 'GET #index' do # before { get :index } # @@ -124,7 +124,7 @@ module ActionController # end # # # RSpec - # describe PostsController do + # RSpec.describe PostsController, type: :controller do # describe 'GET #show' do # before { get :show } # diff --git a/lib/shoulda/matchers/action_controller/set_session_matcher.rb b/lib/shoulda/matchers/action_controller/set_session_matcher.rb index 516831414..01189ebaa 100644 --- a/lib/shoulda/matchers/action_controller/set_session_matcher.rb +++ b/lib/shoulda/matchers/action_controller/set_session_matcher.rb @@ -16,7 +16,7 @@ module ActionController # end # # # RSpec - # describe PostsController do + # RSpec.describe PostsController, type: :controller do # describe 'GET #index' do # before { get :index } # @@ -58,7 +58,7 @@ module ActionController # end # # # RSpec - # describe PostsController do + # RSpec.describe PostsController, type: :controller do # describe 'GET #index' do # before { get :index } # @@ -89,7 +89,7 @@ module ActionController # end # # # RSpec - # describe PostsController do + # RSpec.describe PostsController, type: :controller do # describe 'GET #index' do # before { get :index } # diff --git a/lib/shoulda/matchers/active_model.rb b/lib/shoulda/matchers/active_model.rb index 19f58a4b3..7cb1cd45c 100644 --- a/lib/shoulda/matchers/active_model.rb +++ b/lib/shoulda/matchers/active_model.rb @@ -60,7 +60,7 @@ module Matchers # end # # # RSpec - # describe User do + # RSpec.describe User, type: :model do # context "when an admin" do # subject { User.new(admin: true) } # diff --git a/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb b/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb index b49d373e1..2c81db7b5 100644 --- a/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb @@ -23,11 +23,11 @@ module ActiveModel # end # # # RSpec - # describe Post do + # RSpec.describe Post, type: :model do # it { should allow_mass_assignment_of(:title) } # end # - # describe User do + # RSpec.describe User, type: :model do # it { should_not allow_mass_assignment_of(:encrypted_password) } # end # @@ -56,7 +56,7 @@ module ActiveModel # end # # # RSpec - # describe Post do + # RSpec.describe Post, type: :model do # it { should allow_mass_assignment_of(:title).as(:admin) } # end # diff --git a/lib/shoulda/matchers/active_model/allow_value_matcher.rb b/lib/shoulda/matchers/active_model/allow_value_matcher.rb index 063a989e3..3b99ed1cf 100644 --- a/lib/shoulda/matchers/active_model/allow_value_matcher.rb +++ b/lib/shoulda/matchers/active_model/allow_value_matcher.rb @@ -17,7 +17,7 @@ module ActiveModel # You can use `allow_value` to test one value at a time: # # # RSpec - # describe UserProfile do + # RSpec.describe UserProfile, type: :model do # it { should allow_value('http://foo.com').for(:website_url) } # it { should allow_value('http://bar.com').for(:website_url) } # end @@ -34,7 +34,7 @@ module ActiveModel # that none of the values cause the record to be valid: # # # RSpec - # describe UserProfile do + # RSpec.describe UserProfile, type: :model do # it do # should allow_values('http://foo.com', 'http://bar.com'). # for(:website_url) @@ -82,7 +82,7 @@ module ActiveModel # end # end # - # describe Foo do + # RSpec.describe Foo, type: :model do # it do # foo = Foo.new # foo.bar = "baz" @@ -105,7 +105,7 @@ module ActiveModel # end # end # - # describe Foo do + # RSpec.describe Foo, type: :model do # it do # foo = Foo.new # # This will raise an AttributeChangedValueError since `foo.bar` is now "123" @@ -116,7 +116,7 @@ module ActiveModel # * You're passing a value to `allow_value` that the model typecasts into # another value: # - # describe Foo do + # RSpec.describe Foo, type: :model do # # Assume that `attr` is a string # # This will raise an AttributeChangedValueError since `attr` typecasts `[]` to `"[]"` # it { should_not allow_value([]).for(:attr) } @@ -154,7 +154,7 @@ module ActiveModel # end # # # RSpec - # describe UserProfile do + # RSpec.describe UserProfile, type: :model do # it do # should allow_value('2013-01-01'). # for(:birthday_as_string). @@ -183,7 +183,7 @@ module ActiveModel # end # # # RSpec - # describe UserProfile do + # RSpec.describe UserProfile, type: :model do # it do # should allow_value('open', 'closed'). # for(:state). @@ -210,7 +210,7 @@ module ActiveModel # end # # # RSpec - # describe UserProfile do + # RSpec.describe UserProfile, type: :model do # it do # should allow_value('open', 'closed'). # for(:state). @@ -246,7 +246,7 @@ module ActiveModel # end # # # RSpec - # describe UserProfile do + # RSpec.describe UserProfile, type: :model do # it do # should allow_value('Broncos', 'Titans'). # for(:sports_team). @@ -276,7 +276,7 @@ module ActiveModel # end # # # RSpec - # describe Address do + # RSpec.describe Address, type: :model do # it do # should_not allow_value([]). # for(:zip_code). diff --git a/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb b/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb index 11676b493..e73a75496 100644 --- a/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb +++ b/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb @@ -15,7 +15,7 @@ module ActiveModel # end # # # RSpec - # describe User do + # RSpec.describe User, type: :model do # it { should have_secure_password } # end # diff --git a/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb index 7cc1b21a3..1c33816c0 100644 --- a/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb @@ -12,7 +12,7 @@ module ActiveModel # end # # # RSpec - # describe PowerHungryCountry do + # RSpec.describe PowerHungryCountry, type: :model do # it { should validate_absence_of(:nuclear_weapons) } # end # @@ -35,7 +35,7 @@ module ActiveModel # end # # # RSpec - # describe PowerHungryCountry do + # RSpec.describe PowerHungryCountry, type: :model do # it { should validate_absence_of(:nuclear_weapons).on(:create) } # end # @@ -57,7 +57,7 @@ module ActiveModel # end # # # RSpec - # describe PowerHungryCountry do + # RSpec.describe PowerHungryCountry, type: :model do # it do # should validate_absence_of(:nuclear_weapons). # with_message("there shall be peace on Earth") diff --git a/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb index 1c64d2cbd..69f0f6aab 100644 --- a/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb @@ -12,7 +12,7 @@ module ActiveModel # end # # # RSpec - # describe Registration do + # RSpec.describe Registration, type: :model do # it { should validate_acceptance_of(:eula) } # end # @@ -35,7 +35,7 @@ module ActiveModel # end # # # RSpec - # describe Registration do + # RSpec.describe Registration, type: :model do # it do # should validate_acceptance_of(:terms_of_service). # on(:create) @@ -60,7 +60,7 @@ module ActiveModel # end # # # RSpec - # describe Registration do + # RSpec.describe Registration, type: :model do # it do # should validate_acceptance_of(:terms_of_service). # with_message('You must accept the terms of service') diff --git a/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb index 4edc71e27..f7ff9d49e 100644 --- a/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb @@ -12,7 +12,7 @@ module ActiveModel # end # # # RSpec - # describe User do + # RSpec.describe User, type: :model do # it { should validate_confirmation_of(:email) } # end # @@ -35,7 +35,7 @@ module ActiveModel # end # # # RSpec - # describe User do + # RSpec.describe User, type: :model do # it { should validate_confirmation_of(:password).on(:create) } # end # @@ -57,7 +57,7 @@ module ActiveModel # end # # # RSpec - # describe User do + # RSpec.describe User, type: :model do # it do # should validate_confirmation_of(:password). # with_message('Please re-enter your password') diff --git a/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb index 3a0281ce7..20f6fc43d 100644 --- a/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb @@ -16,7 +16,7 @@ module ActiveModel # end # # # RSpec - # describe Game do + # RSpec.describe Game, type: :model do # it do # should validate_exclusion_of(:supported_os). # in_array(['Mac', 'Linux']) @@ -39,7 +39,7 @@ module ActiveModel # end # # # RSpec - # describe Game do + # RSpec.describe Game, type: :model do # it do # should validate_exclusion_of(:floors_with_enemies). # in_range(5..8) @@ -68,7 +68,7 @@ module ActiveModel # end # # # RSpec - # describe Game do + # RSpec.describe Game, type: :model do # it do # should validate_exclusion_of(:weapon). # in_array(['pistol', 'paintball gun', 'stick']). @@ -97,7 +97,7 @@ module ActiveModel # end # # # RSpec - # describe Game do + # RSpec.describe Game, type: :model do # it do # should validate_exclusion_of(:weapon). # in_array(['pistol', 'paintball gun', 'stick']). diff --git a/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb index 84f329535..fb38410d7 100644 --- a/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb @@ -19,7 +19,7 @@ module ActiveModel # end # # # RSpec - # describe Issue do + # RSpec.describe Issue, type: :model do # it do # should validate_inclusion_of(:state). # in_array(['open', 'resolved', 'unresolved']) @@ -42,7 +42,7 @@ module ActiveModel # end # # # RSpec - # describe Issue do + # RSpec.describe Issue, type: :model do # it { should validate_inclusion_of(:state).in_range(1..5) } # end # @@ -84,7 +84,7 @@ module ActiveModel # end # # # RSpec - # describe Issue do + # RSpec.describe Issue, type: :model do # it do # should validate_inclusion_of(:severity). # in_array(%w(low medium high)). @@ -113,7 +113,7 @@ module ActiveModel # end # # # RSpec - # describe Issue do + # RSpec.describe Issue, type: :model do # it do # should validate_inclusion_of(:severity). # in_array(%w(low medium high)). @@ -149,7 +149,7 @@ module ActiveModel # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should validate_inclusion_of(:age). # in_range(0..65). @@ -185,7 +185,7 @@ module ActiveModel # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should validate_inclusion_of(:age). # in_range(0..21). @@ -215,7 +215,7 @@ module ActiveModel # end # # # RSpec - # describe Issue do + # RSpec.describe Issue, type: :model do # it do # should validate_inclusion_of(:state). # in_array(['open', 'resolved', 'unresolved']). @@ -245,7 +245,7 @@ module ActiveModel # end # # # RSpec - # describe Issue do + # RSpec.describe Issue, type: :model do # it do # should validate_inclusion_of(:state). # in_array(['open', 'resolved', 'unresolved']). diff --git a/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb index 97fa2f471..0679a2760 100644 --- a/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb @@ -17,7 +17,7 @@ module ActiveModel # end # # # RSpec - # describe User do + # RSpec.describe User, type: :model do # it do # should validate_length_of(:password). # is_at_least(10). @@ -47,7 +47,7 @@ module ActiveModel # # # RSpec # - # describe User do + # RSpec.describe User, type: :model do # it { should validate_length_of(:bio).is_at_least(15) } # end # @@ -71,7 +71,7 @@ module ActiveModel # end # # # RSpec - # describe User do + # RSpec.describe User, type: :model do # it { should validate_length_of(:status_update).is_at_most(140) } # end # @@ -94,7 +94,7 @@ module ActiveModel # end # # # RSpec - # describe User do + # RSpec.describe User, type: :model do # it { should validate_length_of(:favorite_superhero).is_equal_to(6) } # end # @@ -116,7 +116,7 @@ module ActiveModel # end # # # RSpec - # describe User do + # RSpec.describe User, type: :model do # it do # should validate_length_of(:password). # is_at_least(5).is_at_most(30) @@ -143,7 +143,7 @@ module ActiveModel # end # # # RSpec - # describe User do + # RSpec.describe User, type: :model do # it do # should validate_length_of(:password). # is_at_least(10). @@ -172,7 +172,7 @@ module ActiveModel # end # # # RSpec - # describe User do + # RSpec.describe User, type: :model do # it do # should validate_length_of(:secret_key). # is_at_least(15). @@ -201,7 +201,7 @@ module ActiveModel # end # # # RSpec - # describe User do + # RSpec.describe User, type: :model do # it do # should validate_length_of(:secret_key). # is_at_most(100). diff --git a/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb index 93af2dbab..e68123288 100644 --- a/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb @@ -12,7 +12,7 @@ module ActiveModel # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should validate_numericality_of(:gpa) } # end # @@ -35,7 +35,7 @@ module ActiveModel # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should validate_numericality_of(:number_of_dependents). # on(:create) @@ -61,7 +61,7 @@ module ActiveModel # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should validate_numericality_of(:age).only_integer } # end # @@ -85,7 +85,7 @@ module ActiveModel # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should validate_numericality_of(:number_of_cars). # is_less_than(2) @@ -113,7 +113,7 @@ module ActiveModel # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should validate_numericality_of(:birth_year). # is_less_than_or_equal_to(1987) @@ -140,7 +140,7 @@ module ActiveModel # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should validate_numericality_of(:weight).is_equal_to(150) } # end # @@ -164,7 +164,7 @@ module ActiveModel # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should validate_numericality_of(:height). # is_greater_than_or_equal_to(55) @@ -191,7 +191,7 @@ module ActiveModel # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should validate_numericality_of(:legal_age). # is_greater_than(21) @@ -217,7 +217,7 @@ module ActiveModel # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should validate_numericality_of(:birth_month).even } # end # @@ -240,7 +240,7 @@ module ActiveModel # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should validate_numericality_of(:birth_day).odd } # end # @@ -262,7 +262,7 @@ module ActiveModel # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should validate_numericality_of(:number_of_dependents). # with_message('Number of dependents must be a number') @@ -287,7 +287,7 @@ module ActiveModel # end # # # RSpec - # describe Post do + # RSpec.describe Post, type: :model do # it { should validate_numericality_of(:age).allow_nil } # end # diff --git a/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb index cd24ce420..9f8dde651 100644 --- a/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb @@ -12,7 +12,7 @@ module ActiveModel # end # # # RSpec - # describe Robot do + # RSpec.describe Robot, type: :model do # it { should validate_presence_of(:arms) } # end # @@ -36,7 +36,7 @@ module ActiveModel # validates_presence_of :password # end # - # describe User do + # RSpec.describe User, type: :model do # subject { User.new(password: '123456') } # # it { should validate_presence_of(:password) } @@ -69,7 +69,7 @@ module ActiveModel # end # # # RSpec - # describe Robot do + # RSpec.describe Robot, type: :model do # it { should validate_presence_of(:arms).on(:create) } # end # @@ -90,7 +90,7 @@ module ActiveModel # end # # # RSpec - # describe Robot do + # RSpec.describe Robot, type: :model do # it do # should validate_presence_of(:legs). # with_message('Robot has no legs') diff --git a/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb b/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb index d04582abb..737b0e52a 100644 --- a/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb +++ b/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb @@ -9,7 +9,7 @@ module ActiveRecord # end # # # RSpec - # describe Car do + # RSpec.describe Car, type: :model do # it { should accept_nested_attributes_for(:doors) } # end # @@ -30,7 +30,7 @@ module ActiveRecord # end # # # RSpec - # describe Car do + # RSpec.describe Car, type: :model do # it do # should accept_nested_attributes_for(:mirrors). # allow_destroy(true) @@ -52,7 +52,7 @@ module ActiveRecord # end # # # RSpec - # describe Car do + # RSpec.describe Car, type: :model do # it do # should accept_nested_attributes_for(:windows). # limit(3) @@ -75,7 +75,7 @@ module ActiveRecord # end # # # RSpec - # describe Car do + # RSpec.describe Car, type: :model do # it do # should accept_nested_attributes_for(:engine). # update_only(true) diff --git a/lib/shoulda/matchers/active_record/association_matcher.rb b/lib/shoulda/matchers/active_record/association_matcher.rb index a0c7219ca..cba6a93db 100644 --- a/lib/shoulda/matchers/active_record/association_matcher.rb +++ b/lib/shoulda/matchers/active_record/association_matcher.rb @@ -11,7 +11,7 @@ module ActiveRecord # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should belong_to(:organization) } # end # @@ -28,7 +28,7 @@ module ActiveRecord # end # # # RSpec - # describe Comment do + # RSpec.describe Comment, type: :model do # it { should belong_to(:commentable) } # end # @@ -49,7 +49,7 @@ module ActiveRecord # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should belong_to(:family). # conditions(everyone_is_perfect: false) @@ -72,7 +72,7 @@ module ActiveRecord # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should belong_to(:previous_company).order('hired_on desc') } # end # @@ -91,7 +91,7 @@ module ActiveRecord # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should belong_to(:ancient_city).class_name('City') } # end # @@ -109,7 +109,7 @@ module ActiveRecord # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should belong_to(:great_country). # with_primary_key('country_id') @@ -131,7 +131,7 @@ module ActiveRecord # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should belong_to(:great_country). # with_foreign_key('country_id') @@ -153,7 +153,7 @@ module ActiveRecord # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should belong_to(:world).dependent(:destroy) } # end # @@ -165,7 +165,7 @@ module ActiveRecord # To assert that *any* `:dependent` option was specified, use `true`: # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should belong_to(:world).dependent(true) } # end # @@ -176,7 +176,7 @@ module ActiveRecord # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should belong_to(:company).dependent(false) } # end # @@ -190,7 +190,7 @@ module ActiveRecord # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should belong_to(:organization).counter_cache(true) } # end # @@ -208,7 +208,7 @@ module ActiveRecord # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should belong_to(:organization).touch(true) } # end # @@ -226,7 +226,7 @@ module ActiveRecord # end # # # RSpec - # describe Account do + # RSpec.describe Account, type: :model do # it { should belong_to(:bank).autosave(true) } # end # @@ -267,7 +267,7 @@ def belong_to(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_many(:friends) } # end # @@ -284,7 +284,7 @@ def belong_to(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_many(:pictures) } # end # @@ -305,7 +305,7 @@ def belong_to(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_many(:coins).conditions(quality: 'mint') } # end # @@ -324,7 +324,7 @@ def belong_to(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_many(:shirts).order('color') } # end # @@ -343,7 +343,7 @@ def belong_to(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_many(:hopes).class_name('Dream') } # end # @@ -361,7 +361,7 @@ def belong_to(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_many(:worries).with_primary_key('worrier_id') } # end # @@ -379,7 +379,7 @@ def belong_to(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_many(:worries).with_foreign_key('worrier_id') } # end # @@ -397,7 +397,7 @@ def belong_to(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_many(:secret_documents).dependent(:destroy) } # end # @@ -416,7 +416,7 @@ def belong_to(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_many(:acquaintances).through(:friends) } # end # @@ -435,7 +435,7 @@ def belong_to(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should have_many(:job_offers). # through(:friends). @@ -459,7 +459,7 @@ def belong_to(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_many(:ideas).validate(false) } # end # @@ -477,7 +477,7 @@ def belong_to(name) # end # # # RSpec - # describe Player do + # RSpec.describe Player, type: :model do # it { should have_many(:games).autosave(true) } # end # @@ -500,7 +500,7 @@ def have_many(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_one(:partner) } # end # @@ -521,7 +521,7 @@ def have_many(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_one(:pet).conditions('weight < 80') } # end # @@ -540,7 +540,7 @@ def have_many(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_one(:focus).order('priority desc') } # end # @@ -559,7 +559,7 @@ def have_many(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_one(:chance).class_name('Opportunity') } # end # @@ -577,7 +577,7 @@ def have_many(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_one(:contract).dependent(:nullify) } # end # @@ -595,7 +595,7 @@ def have_many(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_one(:job).with_primary_key('worker_id') } # end # @@ -613,7 +613,7 @@ def have_many(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_one(:job).with_foreign_key('worker_id') } # end # @@ -632,7 +632,7 @@ def have_many(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_one(:life).through(:partner) } # end # @@ -651,7 +651,7 @@ def have_many(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_one(:car).through(:partner).source(:vehicle) } # end # @@ -669,7 +669,7 @@ def have_many(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_one(:parking_card).validate(false) } # end # @@ -687,7 +687,7 @@ def have_many(name) # end # # # RSpec - # describe Account do + # RSpec.describe Account, type: :model do # it { should have_one(:bank).autosave(true) } # end # @@ -711,7 +711,7 @@ def have_one(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it { should have_and_belong_to_many(:awards) } # end # @@ -732,7 +732,7 @@ def have_one(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should have_and_belong_to_many(:issues). # conditions(difficulty: 'hard') @@ -755,7 +755,7 @@ def have_one(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should have_and_belong_to_many(:projects). # order('time_spent') @@ -778,7 +778,7 @@ def have_one(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should have_and_belong_to_many(:places_visited). # class_name('City') @@ -801,7 +801,7 @@ def have_one(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should have_and_belong_to_many(:issues). # join_table('people_tickets') @@ -823,7 +823,7 @@ def have_one(name) # end # # # RSpec - # describe Person do + # RSpec.describe Person, type: :model do # it do # should have_and_belong_to_many(:interviews). # validate(false) @@ -845,7 +845,7 @@ def have_one(name) # end # # # RSpec - # describe Publisher do + # RSpec.describe Publisher, type: :model do # it { should have_and_belong_to_many(:advertisers).autosave(true) } # end # diff --git a/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb b/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb index 37bf702ab..3db40ebfb 100644 --- a/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb +++ b/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb @@ -9,7 +9,7 @@ module ActiveRecord # end # # # RSpec - # describe Process do + # RSpec.describe Process, type: :model do # it { should define_enum_for(:status) } # end # end @@ -31,7 +31,7 @@ module ActiveRecord # end # # # RSpec - # describe Process do + # RSpec.describe Process, type: :model do # it do # should define_enum_for(:status). # with([:running, :stopped, :suspended]) diff --git a/lib/shoulda/matchers/active_record/have_db_column_matcher.rb b/lib/shoulda/matchers/active_record/have_db_column_matcher.rb index 49f7e928d..98180f47c 100644 --- a/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +++ b/lib/shoulda/matchers/active_record/have_db_column_matcher.rb @@ -13,7 +13,7 @@ module ActiveRecord # end # # # RSpec - # describe Phone do + # RSpec.describe Phone, type: :model do # it { should have_db_column(:supported_ios_version) } # end # @@ -37,7 +37,7 @@ module ActiveRecord # end # # # RSpec - # describe Phone do + # RSpec.describe Phone, type: :model do # it do # should have_db_column(:camera_aperture).of_type(:decimal) # end @@ -63,7 +63,7 @@ module ActiveRecord # end # # # RSpec - # describe Phone do + # RSpec.describe Phone, type: :model do # it do # should have_db_column(:camera_aperture). # with_options(precision: 1, null: false) diff --git a/lib/shoulda/matchers/active_record/have_db_index_matcher.rb b/lib/shoulda/matchers/active_record/have_db_index_matcher.rb index bf313d60e..02b4bc2a1 100644 --- a/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +++ b/lib/shoulda/matchers/active_record/have_db_index_matcher.rb @@ -15,7 +15,7 @@ module ActiveRecord # end # # # RSpec - # describe Blog do + # RSpec.describe Blog, type: :model do # it { should have_db_index(:user_id) } # end # @@ -41,7 +41,7 @@ module ActiveRecord # end # # # RSpec - # describe Blog do + # RSpec.describe Blog, type: :model do # it { should have_db_index(:name).unique(true) } # end # @@ -54,7 +54,7 @@ module ActiveRecord # leave off the argument to save some keystrokes: # # # RSpec - # describe Blog do + # RSpec.describe Blog, type: :model do # it { should have_db_index(:name).unique } # end # diff --git a/lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb b/lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb index 79eafe710..aec93184b 100644 --- a/lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb +++ b/lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb @@ -9,7 +9,7 @@ module ActiveRecord # end # # # RSpec - # describe User do + # RSpec.describe User, type: :model do # it { should have_readonly_attribute(:password) } # end # diff --git a/lib/shoulda/matchers/active_record/serialize_matcher.rb b/lib/shoulda/matchers/active_record/serialize_matcher.rb index f7b38a4b6..83c240b94 100644 --- a/lib/shoulda/matchers/active_record/serialize_matcher.rb +++ b/lib/shoulda/matchers/active_record/serialize_matcher.rb @@ -8,7 +8,7 @@ module ActiveRecord # end # # # RSpec - # describe Product do + # RSpec.describe Product, type: :model do # it { should serialize(:customizations) } # end # @@ -38,7 +38,7 @@ module ActiveRecord # end # # # RSpec - # describe Product do + # RSpec.describe Product, type: :model do # it do # should serialize(:specifications). # as(ProductSpecsSerializer) @@ -70,7 +70,7 @@ module ActiveRecord # end # # # RSpec - # describe Product do + # RSpec.describe Product, type: :model do # it do # should serialize(:options). # as_instance_of(ProductOptionsSerializer) diff --git a/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb b/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb index e16314be8..78026b91a 100644 --- a/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +++ b/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb @@ -14,7 +14,7 @@ module ActiveRecord # end # # # RSpec - # describe Post do + # RSpec.describe Post, type: :model do # it { should validate_uniqueness_of(:permalink) } # end # @@ -49,7 +49,7 @@ module ActiveRecord # # You may be tempted to test the model like this: # - # describe Post do + # RSpec.describe Post, type: :model do # it { should validate_uniqueness_of(:title) } # end # @@ -78,7 +78,7 @@ module ActiveRecord # end of the error message, the solution is to build a custom Post object # ahead of time with `content` filled in: # - # describe Post do + # RSpec.describe Post, type: :model do # describe "validations" do # subject { Post.new(content: "Here is the content") } # it { should validate_uniqueness_of(:title) } @@ -90,7 +90,7 @@ module ActiveRecord # `post` factory defined which automatically fills in `content`, you can # say: # - # describe Post do + # RSpec.describe Post, type: :model do # describe "validations" do # subject { FactoryGirl.build(:post) } # it { should validate_uniqueness_of(:title) } @@ -106,7 +106,7 @@ module ActiveRecord # end # # # RSpec - # describe Post do + # RSpec.describe Post, type: :model do # it { should validate_uniqueness_of(:title).on(:create) } # end # @@ -124,7 +124,7 @@ module ActiveRecord # end # # # RSpec - # describe Post do + # RSpec.describe Post, type: :model do # it do # should validate_uniqueness_of(:title). # with_message('Please choose another title') @@ -148,7 +148,7 @@ module ActiveRecord # end # # # RSpec - # describe Post do + # RSpec.describe Post, type: :model do # it { should validate_uniqueness_of(:slug).scoped_to(:journal_id) } # end # @@ -169,7 +169,7 @@ module ActiveRecord # end # # # RSpec - # describe Post do + # RSpec.describe Post, type: :model do # it { should validate_uniqueness_of(:key).case_insensitive } # end # @@ -201,7 +201,7 @@ module ActiveRecord # end # # # RSpec - # describe Post do + # RSpec.describe Post, type: :model do # it do # should validate_uniqueness_of(:email).ignoring_case_sensitivity # end @@ -221,7 +221,7 @@ module ActiveRecord # end # # # RSpec - # describe Post do + # RSpec.describe Post, type: :model do # it { should validate_uniqueness_of(:author_id).allow_nil } # end # @@ -241,7 +241,7 @@ module ActiveRecord # end # # # RSpec - # describe Post do + # RSpec.describe Post, type: :model do # it { should validate_uniqueness_of(:author_id).allow_blank } # end #