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]
This commit is contained in:
Elliot Winkler 2016-06-15 18:00:51 -06:00
parent a1eee11bac
commit afa6a7b666
32 changed files with 159 additions and 159 deletions

View File

@ -46,7 +46,7 @@ error message explains, you have two options:
end end
# RSpec # RSpec
describe User do RSpec.describe User, type: :model do
context "validations" do context "validations" do
subject do subject do
# Note that "123" == "123".swapcase. This is a problem! # Note that "123" == "123".swapcase. This is a problem!
@ -87,7 +87,7 @@ error message explains, you have two options:
end end
# RSpec # RSpec
describe User do RSpec.describe User, type: :model do
context "validations" do context "validations" do
subject do subject do
# Note that "123" == "123".swapcase, but it's okay # Note that "123" == "123".swapcase, but it's okay

View File

@ -9,7 +9,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe UsersController do # RSpec.describe UsersController, type: :controller do
# it { should use_before_filter(:authenticate_user!) } # it { should use_before_filter(:authenticate_user!) }
# it { should_not use_before_filter(:prevent_ssl) } # it { should_not use_before_filter(:prevent_ssl) }
# end # end
@ -34,7 +34,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe IssuesController do # RSpec.describe IssuesController, type: :controller do
# it { should use_after_filter(:log_activity) } # it { should use_after_filter(:log_activity) }
# it { should_not use_after_filter(:destroy_user) } # it { should_not use_after_filter(:destroy_user) }
# end # end
@ -59,7 +59,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe UsersController do # RSpec.describe UsersController, type: :controller do
# it { should use_before_action(:authenticate_user!) } # it { should use_before_action(:authenticate_user!) }
# it { should_not use_before_action(:prevent_ssl) } # it { should_not use_before_action(:prevent_ssl) }
# end # end
@ -84,7 +84,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe IssuesController do # RSpec.describe IssuesController, type: :controller do
# it { should use_after_action(:log_activity) } # it { should use_after_action(:log_activity) }
# it { should_not use_after_action(:destroy_user) } # it { should_not use_after_action(:destroy_user) }
# end # end
@ -109,7 +109,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe ChangesController do # RSpec.describe ChangesController, type: :controller do
# it { should use_around_filter(:wrap_in_transaction) } # it { should use_around_filter(:wrap_in_transaction) }
# it { should_not use_around_filter(:save_view_context) } # it { should_not use_around_filter(:save_view_context) }
# end # end
@ -134,7 +134,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe ChangesController do # RSpec.describe ChangesController, type: :controller do
# it { should use_around_action(:wrap_in_transaction) } # it { should use_around_action(:wrap_in_transaction) }
# it { should_not use_around_action(:save_view_context) } # it { should_not use_around_action(:save_view_context) }
# end # end

View File

@ -10,7 +10,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe ApplicationController do # RSpec.describe ApplicationController, type: :controller do
# it { should filter_param(:secret_key) } # it { should filter_param(:secret_key) }
# end # end
# #

View File

@ -35,7 +35,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe UsersController do # RSpec.describe UsersController, type: :controller do
# it do # it do
# params = { # params = {
# user: { # user: {
@ -96,7 +96,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe UsersController do # RSpec.describe UsersController, type: :controller do
# before do # before do
# create(:user, id: 1) # create(:user, id: 1)
# end # end
@ -170,7 +170,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe UsersController do # RSpec.describe UsersController, type: :controller do
# before do # before do
# create(:user, id: 1) # create(:user, id: 1)
# end # end

View File

@ -14,7 +14,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PostsController do # RSpec.describe PostsController, type: :controller do
# describe 'GET #show' do # describe 'GET #show' do
# before { get :show } # before { get :show }
# #

View File

@ -15,7 +15,7 @@ module Shoulda
# <%= render 'sidebar' %> # <%= render 'sidebar' %>
# #
# # RSpec # # RSpec
# describe PostsController do # RSpec.describe PostsController, type: :controller do
# describe 'GET #show' do # describe 'GET #show' do
# before { get :show } # before { get :show }
# #

View File

@ -11,7 +11,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PostsController do # RSpec.describe PostsController, type: :controller do
# describe 'GET #show' do # describe 'GET #show' do
# before { get :show } # before { get :show }
# #
@ -38,7 +38,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PostsController do # RSpec.describe PostsController, type: :controller do
# describe 'GET #sidebar' do # describe 'GET #sidebar' do
# before { get :sidebar } # before { get :sidebar }
# #

View File

@ -16,7 +16,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe ApplicationController do # RSpec.describe ApplicationController, type: :controller do
# it do # it do
# should rescue_from(ActiveRecord::RecordNotFound). # should rescue_from(ActiveRecord::RecordNotFound).
# with(:handle_not_found) # with(:handle_not_found)

View File

@ -13,7 +13,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PostsController do # RSpec.describe PostsController, type: :controller do
# describe 'GET #index' do # describe 'GET #index' do
# before { get :index } # before { get :index }
# #
@ -39,7 +39,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PostsController do # RSpec.describe PostsController, type: :controller do
# describe 'DELETE #destroy' do # describe 'DELETE #destroy' do
# before { delete :destroy } # before { delete :destroy }
# #
@ -65,7 +65,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PostsController do # RSpec.describe PostsController, type: :controller do
# describe 'GET #show' do # describe 'GET #show' do
# before { get :show } # before { get :show }
# #

View File

@ -24,7 +24,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PostsController do # RSpec.describe PostsController, type: :controller do
# it { should route(:get, '/posts').to(action: :index) } # it { should route(:get, '/posts').to(action: :index) }
# it { should route(:get, '/posts/1').to(action: :show, id: 1) } # it { should route(:get, '/posts/1').to(action: :show, id: 1) }
# end # end
@ -38,7 +38,7 @@ module Shoulda
# Or you could place the tests along with other route tests: # Or you could place the tests along with other route tests:
# #
# # RSpec # # RSpec
# describe 'Routing' do # describe 'Routing', type: :routing do
# it do # it do
# should route(:get, '/posts'). # should route(:get, '/posts').
# to(controller: :posts, action: :index) # to(controller: :posts, action: :index)

View File

@ -16,7 +16,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PostsController do # RSpec.describe PostsController, type: :controller do
# describe 'GET #index' do # describe 'GET #index' do
# before { get :index } # before { get :index }
# #
@ -58,7 +58,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PostsController do # RSpec.describe PostsController, type: :controller do
# describe 'GET #index' do # describe 'GET #index' do
# before { get :index } # before { get :index }
# #
@ -89,7 +89,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PostsController do # RSpec.describe PostsController, type: :controller do
# describe 'GET #index' do # describe 'GET #index' do
# before { get :index } # before { get :index }
# #
@ -124,7 +124,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PostsController do # RSpec.describe PostsController, type: :controller do
# describe 'GET #show' do # describe 'GET #show' do
# before { get :show } # before { get :show }
# #

View File

@ -16,7 +16,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PostsController do # RSpec.describe PostsController, type: :controller do
# describe 'GET #index' do # describe 'GET #index' do
# before { get :index } # before { get :index }
# #
@ -58,7 +58,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PostsController do # RSpec.describe PostsController, type: :controller do
# describe 'GET #index' do # describe 'GET #index' do
# before { get :index } # before { get :index }
# #
@ -89,7 +89,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PostsController do # RSpec.describe PostsController, type: :controller do
# describe 'GET #index' do # describe 'GET #index' do
# before { get :index } # before { get :index }
# #

View File

@ -60,7 +60,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe User do # RSpec.describe User, type: :model do
# context "when an admin" do # context "when an admin" do
# subject { User.new(admin: true) } # subject { User.new(admin: true) }
# #

View File

@ -23,11 +23,11 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Post do # RSpec.describe Post, type: :model do
# it { should allow_mass_assignment_of(:title) } # it { should allow_mass_assignment_of(:title) }
# end # end
# #
# describe User do # RSpec.describe User, type: :model do
# it { should_not allow_mass_assignment_of(:encrypted_password) } # it { should_not allow_mass_assignment_of(:encrypted_password) }
# end # end
# #
@ -56,7 +56,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Post do # RSpec.describe Post, type: :model do
# it { should allow_mass_assignment_of(:title).as(:admin) } # it { should allow_mass_assignment_of(:title).as(:admin) }
# end # end
# #

View File

@ -17,7 +17,7 @@ module Shoulda
# You can use `allow_value` to test one value at a time: # You can use `allow_value` to test one value at a time:
# #
# # RSpec # # 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://foo.com').for(:website_url) }
# it { should allow_value('http://bar.com').for(:website_url) } # it { should allow_value('http://bar.com').for(:website_url) }
# end # end
@ -34,7 +34,7 @@ module Shoulda
# that none of the values cause the record to be valid: # that none of the values cause the record to be valid:
# #
# # RSpec # # RSpec
# describe UserProfile do # RSpec.describe UserProfile, type: :model do
# it do # it do
# should allow_values('http://foo.com', 'http://bar.com'). # should allow_values('http://foo.com', 'http://bar.com').
# for(:website_url) # for(:website_url)
@ -82,7 +82,7 @@ module Shoulda
# end # end
# end # end
# #
# describe Foo do # RSpec.describe Foo, type: :model do
# it do # it do
# foo = Foo.new # foo = Foo.new
# foo.bar = "baz" # foo.bar = "baz"
@ -105,7 +105,7 @@ module Shoulda
# end # end
# end # end
# #
# describe Foo do # RSpec.describe Foo, type: :model do
# it do # it do
# foo = Foo.new # foo = Foo.new
# # This will raise an AttributeChangedValueError since `foo.bar` is now "123" # # This will raise an AttributeChangedValueError since `foo.bar` is now "123"
@ -116,7 +116,7 @@ module Shoulda
# * You're passing a value to `allow_value` that the model typecasts into # * You're passing a value to `allow_value` that the model typecasts into
# another value: # another value:
# #
# describe Foo do # RSpec.describe Foo, type: :model do
# # Assume that `attr` is a string # # Assume that `attr` is a string
# # This will raise an AttributeChangedValueError since `attr` typecasts `[]` to `"[]"` # # This will raise an AttributeChangedValueError since `attr` typecasts `[]` to `"[]"`
# it { should_not allow_value([]).for(:attr) } # it { should_not allow_value([]).for(:attr) }
@ -154,7 +154,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe UserProfile do # RSpec.describe UserProfile, type: :model do
# it do # it do
# should allow_value('2013-01-01'). # should allow_value('2013-01-01').
# for(:birthday_as_string). # for(:birthday_as_string).
@ -183,7 +183,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe UserProfile do # RSpec.describe UserProfile, type: :model do
# it do # it do
# should allow_value('open', 'closed'). # should allow_value('open', 'closed').
# for(:state). # for(:state).
@ -210,7 +210,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe UserProfile do # RSpec.describe UserProfile, type: :model do
# it do # it do
# should allow_value('open', 'closed'). # should allow_value('open', 'closed').
# for(:state). # for(:state).
@ -246,7 +246,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe UserProfile do # RSpec.describe UserProfile, type: :model do
# it do # it do
# should allow_value('Broncos', 'Titans'). # should allow_value('Broncos', 'Titans').
# for(:sports_team). # for(:sports_team).
@ -276,7 +276,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Address do # RSpec.describe Address, type: :model do
# it do # it do
# should_not allow_value([]). # should_not allow_value([]).
# for(:zip_code). # for(:zip_code).

View File

@ -15,7 +15,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe User do # RSpec.describe User, type: :model do
# it { should have_secure_password } # it { should have_secure_password }
# end # end
# #

View File

@ -12,7 +12,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PowerHungryCountry do # RSpec.describe PowerHungryCountry, type: :model do
# it { should validate_absence_of(:nuclear_weapons) } # it { should validate_absence_of(:nuclear_weapons) }
# end # end
# #
@ -35,7 +35,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PowerHungryCountry do # RSpec.describe PowerHungryCountry, type: :model do
# it { should validate_absence_of(:nuclear_weapons).on(:create) } # it { should validate_absence_of(:nuclear_weapons).on(:create) }
# end # end
# #
@ -57,7 +57,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe PowerHungryCountry do # RSpec.describe PowerHungryCountry, type: :model do
# it do # it do
# should validate_absence_of(:nuclear_weapons). # should validate_absence_of(:nuclear_weapons).
# with_message("there shall be peace on Earth") # with_message("there shall be peace on Earth")

View File

@ -12,7 +12,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Registration do # RSpec.describe Registration, type: :model do
# it { should validate_acceptance_of(:eula) } # it { should validate_acceptance_of(:eula) }
# end # end
# #
@ -35,7 +35,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Registration do # RSpec.describe Registration, type: :model do
# it do # it do
# should validate_acceptance_of(:terms_of_service). # should validate_acceptance_of(:terms_of_service).
# on(:create) # on(:create)
@ -60,7 +60,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Registration do # RSpec.describe Registration, type: :model do
# it do # it do
# should validate_acceptance_of(:terms_of_service). # should validate_acceptance_of(:terms_of_service).
# with_message('You must accept the terms of service') # with_message('You must accept the terms of service')

View File

@ -12,7 +12,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe User do # RSpec.describe User, type: :model do
# it { should validate_confirmation_of(:email) } # it { should validate_confirmation_of(:email) }
# end # end
# #
@ -35,7 +35,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe User do # RSpec.describe User, type: :model do
# it { should validate_confirmation_of(:password).on(:create) } # it { should validate_confirmation_of(:password).on(:create) }
# end # end
# #
@ -57,7 +57,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe User do # RSpec.describe User, type: :model do
# it do # it do
# should validate_confirmation_of(:password). # should validate_confirmation_of(:password).
# with_message('Please re-enter your password') # with_message('Please re-enter your password')

View File

@ -16,7 +16,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Game do # RSpec.describe Game, type: :model do
# it do # it do
# should validate_exclusion_of(:supported_os). # should validate_exclusion_of(:supported_os).
# in_array(['Mac', 'Linux']) # in_array(['Mac', 'Linux'])
@ -39,7 +39,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Game do # RSpec.describe Game, type: :model do
# it do # it do
# should validate_exclusion_of(:floors_with_enemies). # should validate_exclusion_of(:floors_with_enemies).
# in_range(5..8) # in_range(5..8)
@ -68,7 +68,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Game do # RSpec.describe Game, type: :model do
# it do # it do
# should validate_exclusion_of(:weapon). # should validate_exclusion_of(:weapon).
# in_array(['pistol', 'paintball gun', 'stick']). # in_array(['pistol', 'paintball gun', 'stick']).
@ -97,7 +97,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Game do # RSpec.describe Game, type: :model do
# it do # it do
# should validate_exclusion_of(:weapon). # should validate_exclusion_of(:weapon).
# in_array(['pistol', 'paintball gun', 'stick']). # in_array(['pistol', 'paintball gun', 'stick']).

View File

@ -19,7 +19,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Issue do # RSpec.describe Issue, type: :model do
# it do # it do
# should validate_inclusion_of(:state). # should validate_inclusion_of(:state).
# in_array(['open', 'resolved', 'unresolved']) # in_array(['open', 'resolved', 'unresolved'])
@ -42,7 +42,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Issue do # RSpec.describe Issue, type: :model do
# it { should validate_inclusion_of(:state).in_range(1..5) } # it { should validate_inclusion_of(:state).in_range(1..5) }
# end # end
# #
@ -84,7 +84,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Issue do # RSpec.describe Issue, type: :model do
# it do # it do
# should validate_inclusion_of(:severity). # should validate_inclusion_of(:severity).
# in_array(%w(low medium high)). # in_array(%w(low medium high)).
@ -113,7 +113,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Issue do # RSpec.describe Issue, type: :model do
# it do # it do
# should validate_inclusion_of(:severity). # should validate_inclusion_of(:severity).
# in_array(%w(low medium high)). # in_array(%w(low medium high)).
@ -149,7 +149,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should validate_inclusion_of(:age). # should validate_inclusion_of(:age).
# in_range(0..65). # in_range(0..65).
@ -185,7 +185,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should validate_inclusion_of(:age). # should validate_inclusion_of(:age).
# in_range(0..21). # in_range(0..21).
@ -215,7 +215,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Issue do # RSpec.describe Issue, type: :model do
# it do # it do
# should validate_inclusion_of(:state). # should validate_inclusion_of(:state).
# in_array(['open', 'resolved', 'unresolved']). # in_array(['open', 'resolved', 'unresolved']).
@ -245,7 +245,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Issue do # RSpec.describe Issue, type: :model do
# it do # it do
# should validate_inclusion_of(:state). # should validate_inclusion_of(:state).
# in_array(['open', 'resolved', 'unresolved']). # in_array(['open', 'resolved', 'unresolved']).

View File

@ -17,7 +17,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe User do # RSpec.describe User, type: :model do
# it do # it do
# should validate_length_of(:password). # should validate_length_of(:password).
# is_at_least(10). # is_at_least(10).
@ -47,7 +47,7 @@ module Shoulda
# #
# # RSpec # # RSpec
# #
# describe User do # RSpec.describe User, type: :model do
# it { should validate_length_of(:bio).is_at_least(15) } # it { should validate_length_of(:bio).is_at_least(15) }
# end # end
# #
@ -71,7 +71,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe User do # RSpec.describe User, type: :model do
# it { should validate_length_of(:status_update).is_at_most(140) } # it { should validate_length_of(:status_update).is_at_most(140) }
# end # end
# #
@ -94,7 +94,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe User do # RSpec.describe User, type: :model do
# it { should validate_length_of(:favorite_superhero).is_equal_to(6) } # it { should validate_length_of(:favorite_superhero).is_equal_to(6) }
# end # end
# #
@ -116,7 +116,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe User do # RSpec.describe User, type: :model do
# it do # it do
# should validate_length_of(:password). # should validate_length_of(:password).
# is_at_least(5).is_at_most(30) # is_at_least(5).is_at_most(30)
@ -143,7 +143,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe User do # RSpec.describe User, type: :model do
# it do # it do
# should validate_length_of(:password). # should validate_length_of(:password).
# is_at_least(10). # is_at_least(10).
@ -172,7 +172,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe User do # RSpec.describe User, type: :model do
# it do # it do
# should validate_length_of(:secret_key). # should validate_length_of(:secret_key).
# is_at_least(15). # is_at_least(15).
@ -201,7 +201,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe User do # RSpec.describe User, type: :model do
# it do # it do
# should validate_length_of(:secret_key). # should validate_length_of(:secret_key).
# is_at_most(100). # is_at_most(100).

View File

@ -12,7 +12,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should validate_numericality_of(:gpa) } # it { should validate_numericality_of(:gpa) }
# end # end
# #
@ -35,7 +35,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should validate_numericality_of(:number_of_dependents). # should validate_numericality_of(:number_of_dependents).
# on(:create) # on(:create)
@ -61,7 +61,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should validate_numericality_of(:age).only_integer } # it { should validate_numericality_of(:age).only_integer }
# end # end
# #
@ -85,7 +85,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should validate_numericality_of(:number_of_cars). # should validate_numericality_of(:number_of_cars).
# is_less_than(2) # is_less_than(2)
@ -113,7 +113,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should validate_numericality_of(:birth_year). # should validate_numericality_of(:birth_year).
# is_less_than_or_equal_to(1987) # is_less_than_or_equal_to(1987)
@ -140,7 +140,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should validate_numericality_of(:weight).is_equal_to(150) } # it { should validate_numericality_of(:weight).is_equal_to(150) }
# end # end
# #
@ -164,7 +164,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should validate_numericality_of(:height). # should validate_numericality_of(:height).
# is_greater_than_or_equal_to(55) # is_greater_than_or_equal_to(55)
@ -191,7 +191,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should validate_numericality_of(:legal_age). # should validate_numericality_of(:legal_age).
# is_greater_than(21) # is_greater_than(21)
@ -217,7 +217,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should validate_numericality_of(:birth_month).even } # it { should validate_numericality_of(:birth_month).even }
# end # end
# #
@ -240,7 +240,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should validate_numericality_of(:birth_day).odd } # it { should validate_numericality_of(:birth_day).odd }
# end # end
# #
@ -262,7 +262,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should validate_numericality_of(:number_of_dependents). # should validate_numericality_of(:number_of_dependents).
# with_message('Number of dependents must be a number') # with_message('Number of dependents must be a number')
@ -287,7 +287,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Post do # RSpec.describe Post, type: :model do
# it { should validate_numericality_of(:age).allow_nil } # it { should validate_numericality_of(:age).allow_nil }
# end # end
# #

View File

@ -12,7 +12,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Robot do # RSpec.describe Robot, type: :model do
# it { should validate_presence_of(:arms) } # it { should validate_presence_of(:arms) }
# end # end
# #
@ -36,7 +36,7 @@ module Shoulda
# validates_presence_of :password # validates_presence_of :password
# end # end
# #
# describe User do # RSpec.describe User, type: :model do
# subject { User.new(password: '123456') } # subject { User.new(password: '123456') }
# #
# it { should validate_presence_of(:password) } # it { should validate_presence_of(:password) }
@ -69,7 +69,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Robot do # RSpec.describe Robot, type: :model do
# it { should validate_presence_of(:arms).on(:create) } # it { should validate_presence_of(:arms).on(:create) }
# end # end
# #
@ -90,7 +90,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Robot do # RSpec.describe Robot, type: :model do
# it do # it do
# should validate_presence_of(:legs). # should validate_presence_of(:legs).
# with_message('Robot has no legs') # with_message('Robot has no legs')

View File

@ -9,7 +9,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Car do # RSpec.describe Car, type: :model do
# it { should accept_nested_attributes_for(:doors) } # it { should accept_nested_attributes_for(:doors) }
# end # end
# #
@ -30,7 +30,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Car do # RSpec.describe Car, type: :model do
# it do # it do
# should accept_nested_attributes_for(:mirrors). # should accept_nested_attributes_for(:mirrors).
# allow_destroy(true) # allow_destroy(true)
@ -52,7 +52,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Car do # RSpec.describe Car, type: :model do
# it do # it do
# should accept_nested_attributes_for(:windows). # should accept_nested_attributes_for(:windows).
# limit(3) # limit(3)
@ -75,7 +75,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Car do # RSpec.describe Car, type: :model do
# it do # it do
# should accept_nested_attributes_for(:engine). # should accept_nested_attributes_for(:engine).
# update_only(true) # update_only(true)

View File

@ -11,7 +11,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should belong_to(:organization) } # it { should belong_to(:organization) }
# end # end
# #
@ -28,7 +28,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Comment do # RSpec.describe Comment, type: :model do
# it { should belong_to(:commentable) } # it { should belong_to(:commentable) }
# end # end
# #
@ -49,7 +49,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should belong_to(:family). # should belong_to(:family).
# conditions(everyone_is_perfect: false) # conditions(everyone_is_perfect: false)
@ -72,7 +72,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should belong_to(:previous_company).order('hired_on desc') } # it { should belong_to(:previous_company).order('hired_on desc') }
# end # end
# #
@ -91,7 +91,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should belong_to(:ancient_city).class_name('City') } # it { should belong_to(:ancient_city).class_name('City') }
# end # end
# #
@ -109,7 +109,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should belong_to(:great_country). # should belong_to(:great_country).
# with_primary_key('country_id') # with_primary_key('country_id')
@ -131,7 +131,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should belong_to(:great_country). # should belong_to(:great_country).
# with_foreign_key('country_id') # with_foreign_key('country_id')
@ -153,7 +153,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should belong_to(:world).dependent(:destroy) } # it { should belong_to(:world).dependent(:destroy) }
# end # end
# #
@ -165,7 +165,7 @@ module Shoulda
# To assert that *any* `:dependent` option was specified, use `true`: # To assert that *any* `:dependent` option was specified, use `true`:
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should belong_to(:world).dependent(true) } # it { should belong_to(:world).dependent(true) }
# end # end
# #
@ -176,7 +176,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should belong_to(:company).dependent(false) } # it { should belong_to(:company).dependent(false) }
# end # end
# #
@ -190,7 +190,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should belong_to(:organization).counter_cache(true) } # it { should belong_to(:organization).counter_cache(true) }
# end # end
# #
@ -208,7 +208,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should belong_to(:organization).touch(true) } # it { should belong_to(:organization).touch(true) }
# end # end
# #
@ -226,7 +226,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Account do # RSpec.describe Account, type: :model do
# it { should belong_to(:bank).autosave(true) } # it { should belong_to(:bank).autosave(true) }
# end # end
# #
@ -267,7 +267,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_many(:friends) } # it { should have_many(:friends) }
# end # end
# #
@ -284,7 +284,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_many(:pictures) } # it { should have_many(:pictures) }
# end # end
# #
@ -305,7 +305,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_many(:coins).conditions(quality: 'mint') } # it { should have_many(:coins).conditions(quality: 'mint') }
# end # end
# #
@ -324,7 +324,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_many(:shirts).order('color') } # it { should have_many(:shirts).order('color') }
# end # end
# #
@ -343,7 +343,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_many(:hopes).class_name('Dream') } # it { should have_many(:hopes).class_name('Dream') }
# end # end
# #
@ -361,7 +361,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_many(:worries).with_primary_key('worrier_id') } # it { should have_many(:worries).with_primary_key('worrier_id') }
# end # end
# #
@ -379,7 +379,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_many(:worries).with_foreign_key('worrier_id') } # it { should have_many(:worries).with_foreign_key('worrier_id') }
# end # end
# #
@ -397,7 +397,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_many(:secret_documents).dependent(:destroy) } # it { should have_many(:secret_documents).dependent(:destroy) }
# end # end
# #
@ -416,7 +416,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_many(:acquaintances).through(:friends) } # it { should have_many(:acquaintances).through(:friends) }
# end # end
# #
@ -435,7 +435,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should have_many(:job_offers). # should have_many(:job_offers).
# through(:friends). # through(:friends).
@ -459,7 +459,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_many(:ideas).validate(false) } # it { should have_many(:ideas).validate(false) }
# end # end
# #
@ -477,7 +477,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Player do # RSpec.describe Player, type: :model do
# it { should have_many(:games).autosave(true) } # it { should have_many(:games).autosave(true) }
# end # end
# #
@ -500,7 +500,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_one(:partner) } # it { should have_one(:partner) }
# end # end
# #
@ -521,7 +521,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_one(:pet).conditions('weight < 80') } # it { should have_one(:pet).conditions('weight < 80') }
# end # end
# #
@ -540,7 +540,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_one(:focus).order('priority desc') } # it { should have_one(:focus).order('priority desc') }
# end # end
# #
@ -559,7 +559,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_one(:chance).class_name('Opportunity') } # it { should have_one(:chance).class_name('Opportunity') }
# end # end
# #
@ -577,7 +577,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_one(:contract).dependent(:nullify) } # it { should have_one(:contract).dependent(:nullify) }
# end # end
# #
@ -595,7 +595,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_one(:job).with_primary_key('worker_id') } # it { should have_one(:job).with_primary_key('worker_id') }
# end # end
# #
@ -613,7 +613,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_one(:job).with_foreign_key('worker_id') } # it { should have_one(:job).with_foreign_key('worker_id') }
# end # end
# #
@ -632,7 +632,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_one(:life).through(:partner) } # it { should have_one(:life).through(:partner) }
# end # end
# #
@ -651,7 +651,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_one(:car).through(:partner).source(:vehicle) } # it { should have_one(:car).through(:partner).source(:vehicle) }
# end # end
# #
@ -669,7 +669,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_one(:parking_card).validate(false) } # it { should have_one(:parking_card).validate(false) }
# end # end
# #
@ -687,7 +687,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Account do # RSpec.describe Account, type: :model do
# it { should have_one(:bank).autosave(true) } # it { should have_one(:bank).autosave(true) }
# end # end
# #
@ -711,7 +711,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it { should have_and_belong_to_many(:awards) } # it { should have_and_belong_to_many(:awards) }
# end # end
# #
@ -732,7 +732,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should have_and_belong_to_many(:issues). # should have_and_belong_to_many(:issues).
# conditions(difficulty: 'hard') # conditions(difficulty: 'hard')
@ -755,7 +755,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should have_and_belong_to_many(:projects). # should have_and_belong_to_many(:projects).
# order('time_spent') # order('time_spent')
@ -778,7 +778,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should have_and_belong_to_many(:places_visited). # should have_and_belong_to_many(:places_visited).
# class_name('City') # class_name('City')
@ -801,7 +801,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should have_and_belong_to_many(:issues). # should have_and_belong_to_many(:issues).
# join_table('people_tickets') # join_table('people_tickets')
@ -823,7 +823,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Person do # RSpec.describe Person, type: :model do
# it do # it do
# should have_and_belong_to_many(:interviews). # should have_and_belong_to_many(:interviews).
# validate(false) # validate(false)
@ -845,7 +845,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Publisher do # RSpec.describe Publisher, type: :model do
# it { should have_and_belong_to_many(:advertisers).autosave(true) } # it { should have_and_belong_to_many(:advertisers).autosave(true) }
# end # end
# #

View File

@ -9,7 +9,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Process do # RSpec.describe Process, type: :model do
# it { should define_enum_for(:status) } # it { should define_enum_for(:status) }
# end # end
# end # end
@ -31,7 +31,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Process do # RSpec.describe Process, type: :model do
# it do # it do
# should define_enum_for(:status). # should define_enum_for(:status).
# with([:running, :stopped, :suspended]) # with([:running, :stopped, :suspended])

View File

@ -13,7 +13,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Phone do # RSpec.describe Phone, type: :model do
# it { should have_db_column(:supported_ios_version) } # it { should have_db_column(:supported_ios_version) }
# end # end
# #
@ -37,7 +37,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Phone do # RSpec.describe Phone, type: :model do
# it do # it do
# should have_db_column(:camera_aperture).of_type(:decimal) # should have_db_column(:camera_aperture).of_type(:decimal)
# end # end
@ -63,7 +63,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Phone do # RSpec.describe Phone, type: :model do
# it do # it do
# should have_db_column(:camera_aperture). # should have_db_column(:camera_aperture).
# with_options(precision: 1, null: false) # with_options(precision: 1, null: false)

View File

@ -15,7 +15,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Blog do # RSpec.describe Blog, type: :model do
# it { should have_db_index(:user_id) } # it { should have_db_index(:user_id) }
# end # end
# #
@ -41,7 +41,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Blog do # RSpec.describe Blog, type: :model do
# it { should have_db_index(:name).unique(true) } # it { should have_db_index(:name).unique(true) }
# end # end
# #
@ -54,7 +54,7 @@ module Shoulda
# leave off the argument to save some keystrokes: # leave off the argument to save some keystrokes:
# #
# # RSpec # # RSpec
# describe Blog do # RSpec.describe Blog, type: :model do
# it { should have_db_index(:name).unique } # it { should have_db_index(:name).unique }
# end # end
# #

View File

@ -9,7 +9,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe User do # RSpec.describe User, type: :model do
# it { should have_readonly_attribute(:password) } # it { should have_readonly_attribute(:password) }
# end # end
# #

View File

@ -8,7 +8,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Product do # RSpec.describe Product, type: :model do
# it { should serialize(:customizations) } # it { should serialize(:customizations) }
# end # end
# #
@ -38,7 +38,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Product do # RSpec.describe Product, type: :model do
# it do # it do
# should serialize(:specifications). # should serialize(:specifications).
# as(ProductSpecsSerializer) # as(ProductSpecsSerializer)
@ -70,7 +70,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Product do # RSpec.describe Product, type: :model do
# it do # it do
# should serialize(:options). # should serialize(:options).
# as_instance_of(ProductOptionsSerializer) # as_instance_of(ProductOptionsSerializer)

View File

@ -14,7 +14,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Post do # RSpec.describe Post, type: :model do
# it { should validate_uniqueness_of(:permalink) } # it { should validate_uniqueness_of(:permalink) }
# end # end
# #
@ -49,7 +49,7 @@ module Shoulda
# #
# You may be tempted to test the model like this: # 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) } # it { should validate_uniqueness_of(:title) }
# end # end
# #
@ -78,7 +78,7 @@ module Shoulda
# end of the error message, the solution is to build a custom Post object # end of the error message, the solution is to build a custom Post object
# ahead of time with `content` filled in: # ahead of time with `content` filled in:
# #
# describe Post do # RSpec.describe Post, type: :model do
# describe "validations" do # describe "validations" do
# subject { Post.new(content: "Here is the content") } # subject { Post.new(content: "Here is the content") }
# it { should validate_uniqueness_of(:title) } # it { should validate_uniqueness_of(:title) }
@ -90,7 +90,7 @@ module Shoulda
# `post` factory defined which automatically fills in `content`, you can # `post` factory defined which automatically fills in `content`, you can
# say: # say:
# #
# describe Post do # RSpec.describe Post, type: :model do
# describe "validations" do # describe "validations" do
# subject { FactoryGirl.build(:post) } # subject { FactoryGirl.build(:post) }
# it { should validate_uniqueness_of(:title) } # it { should validate_uniqueness_of(:title) }
@ -106,7 +106,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Post do # RSpec.describe Post, type: :model do
# it { should validate_uniqueness_of(:title).on(:create) } # it { should validate_uniqueness_of(:title).on(:create) }
# end # end
# #
@ -124,7 +124,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Post do # RSpec.describe Post, type: :model do
# it do # it do
# should validate_uniqueness_of(:title). # should validate_uniqueness_of(:title).
# with_message('Please choose another title') # with_message('Please choose another title')
@ -148,7 +148,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Post do # RSpec.describe Post, type: :model do
# it { should validate_uniqueness_of(:slug).scoped_to(:journal_id) } # it { should validate_uniqueness_of(:slug).scoped_to(:journal_id) }
# end # end
# #
@ -169,7 +169,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Post do # RSpec.describe Post, type: :model do
# it { should validate_uniqueness_of(:key).case_insensitive } # it { should validate_uniqueness_of(:key).case_insensitive }
# end # end
# #
@ -201,7 +201,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Post do # RSpec.describe Post, type: :model do
# it do # it do
# should validate_uniqueness_of(:email).ignoring_case_sensitivity # should validate_uniqueness_of(:email).ignoring_case_sensitivity
# end # end
@ -221,7 +221,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Post do # RSpec.describe Post, type: :model do
# it { should validate_uniqueness_of(:author_id).allow_nil } # it { should validate_uniqueness_of(:author_id).allow_nil }
# end # end
# #
@ -241,7 +241,7 @@ module Shoulda
# end # end
# #
# # RSpec # # RSpec
# describe Post do # RSpec.describe Post, type: :model do
# it { should validate_uniqueness_of(:author_id).allow_blank } # it { should validate_uniqueness_of(:author_id).allow_blank }
# end # end
# #