Use eq instead of == in specs to follow style guide
This commit is contained in:
parent
63b06019dd
commit
8130adf61e
|
@ -37,6 +37,6 @@ describe Shoulda::Matchers::ActionController::RedirectToMatcher do
|
|||
it 'provides the correct description when provided a block' do
|
||||
matcher = redirect_to('somewhere else') { '/some/other/url' }
|
||||
|
||||
matcher.description.should == 'redirect to somewhere else'
|
||||
matcher.description.should eq 'redirect to somewhere else'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,16 +4,16 @@ describe Shoulda::Matchers::ActiveModel::AllowMassAssignmentOfMatcher do
|
|||
context '#description' do
|
||||
context 'without a role' do
|
||||
it 'includes the attribute name' do
|
||||
described_class.new(:attr).description.should ==
|
||||
'allow mass assignment of attr'
|
||||
described_class.new(:attr).description.
|
||||
should eq 'allow mass assignment of attr'
|
||||
end
|
||||
end
|
||||
|
||||
if active_model_3_1?
|
||||
context 'with a role' do
|
||||
it 'includes the attribute name and the role' do
|
||||
described_class.new(:attr).as(:admin).description.should ==
|
||||
'allow mass assignment of attr as admin'
|
||||
described_class.new(:attr).as(:admin).description.
|
||||
should eq 'allow mass assignment of attr as admin'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,21 +5,21 @@ describe Shoulda::Matchers::ActiveModel::AllowValueMatcher do
|
|||
it 'describes itself with multiple values' do
|
||||
matcher = allow_value('foo', 'bar').for(:baz)
|
||||
|
||||
matcher.description.should == 'allow baz to be set to any of ["foo", "bar"]'
|
||||
matcher.description.should eq 'allow baz to be set to any of ["foo", "bar"]'
|
||||
end
|
||||
|
||||
it 'describes itself with a single value' do
|
||||
matcher = allow_value('foo').for(:baz)
|
||||
|
||||
matcher.description.should == 'allow baz to be set to "foo"'
|
||||
matcher.description.should eq 'allow baz to be set to "foo"'
|
||||
end
|
||||
|
||||
if active_model_3_2?
|
||||
it 'describes itself with a strict validation' do
|
||||
strict_matcher = allow_value('xyz').for(:attr).strict
|
||||
|
||||
strict_matcher.description.should ==
|
||||
%q(doesn't raise when attr is set to "xyz")
|
||||
strict_matcher.description.
|
||||
should eq %q(doesn't raise when attr is set to "xyz")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -162,7 +162,7 @@ describe Shoulda::Matchers::ActiveModel::AllowValueMatcher do
|
|||
|
||||
matcher.matches?(validating_format(:with => /abc/, :strict => true))
|
||||
|
||||
matcher.failure_message_for_should_not.should == 'Expected exception to include /abc/ ' +
|
||||
matcher.failure_message_for_should_not.should eq 'Expected exception to include /abc/ ' +
|
||||
'when attr is set to "xyz", got Attr is invalid'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
|||
|
||||
describe Shoulda::Matchers::ActiveModel::DisallowValueMatcher do
|
||||
it 'does not allow any types' do
|
||||
matcher('abcde').allowed_types.should == ''
|
||||
matcher('abcde').allowed_types.should eq ''
|
||||
end
|
||||
|
||||
context 'an attribute with a format validation' do
|
||||
|
@ -46,7 +46,7 @@ describe Shoulda::Matchers::ActiveModel::DisallowValueMatcher do
|
|||
matcher = matcher('abcde').for(:attr).with_message('good message')
|
||||
matcher.matches?(validating_format(:with => /abc/, :message => 'good message'))
|
||||
|
||||
matcher.failure_message_for_should.should == 'allow matcher failure'
|
||||
matcher.failure_message_for_should.should eq 'allow matcher failure'
|
||||
end
|
||||
|
||||
it 'matches if the message is correct but the value is not' do
|
||||
|
|
|
@ -77,7 +77,7 @@ describe Shoulda::Matchers::ActiveModel::EnsureExclusionOfMatcher do
|
|||
|
||||
it 'has correct description' do
|
||||
ensure_exclusion_of(:attr).in_array([true, 'dog']).description.
|
||||
should == 'ensure exclusion of attr in [true, "dog"]'
|
||||
should eq 'ensure exclusion of attr in [true, "dog"]'
|
||||
end
|
||||
|
||||
def validating_exclusion(options)
|
||||
|
|
|
@ -129,7 +129,7 @@ describe Shoulda::Matchers::ActiveModel::EnsureInclusionOfMatcher do
|
|||
|
||||
it 'has correct description' do
|
||||
ensure_inclusion_of(:attr).in_array([true, "dog"]).description.
|
||||
should == 'ensure inclusion of attr in [true, "dog"]'
|
||||
should eq 'ensure inclusion of attr in [true, "dog"]'
|
||||
end
|
||||
|
||||
it 'rejects allow_blank' do
|
||||
|
|
|
@ -8,7 +8,7 @@ describe Shoulda::Matchers::ActiveModel::ExceptionMessageFinder do
|
|||
|
||||
description = finder.allow_description('allowed values')
|
||||
|
||||
description.should == %q(doesn't raise when attr is set to allowed values)
|
||||
description.should eq %q(doesn't raise when attr is set to allowed values)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -18,7 +18,7 @@ describe Shoulda::Matchers::ActiveModel::ExceptionMessageFinder do
|
|||
|
||||
message = finder.expected_message_from('some message')
|
||||
|
||||
message.should == 'Attr some message'
|
||||
message.should eq 'Attr some message'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -50,7 +50,7 @@ describe Shoulda::Matchers::ActiveModel::ExceptionMessageFinder do
|
|||
|
||||
messages = finder.messages
|
||||
|
||||
messages.should == ['Attr is invalid']
|
||||
messages.should eq ['Attr is invalid']
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -64,7 +64,7 @@ describe Shoulda::Matchers::ActiveModel::ExceptionMessageFinder do
|
|||
|
||||
description = finder.messages_description
|
||||
|
||||
description.should == 'Attr is invalid'
|
||||
description.should eq 'Attr is invalid'
|
||||
end
|
||||
|
||||
it 'describes errors when there are none' do
|
||||
|
@ -72,7 +72,7 @@ describe Shoulda::Matchers::ActiveModel::ExceptionMessageFinder do
|
|||
|
||||
description = finder.messages_description
|
||||
|
||||
description.should == 'no exception'
|
||||
description.should eq 'no exception'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -82,7 +82,7 @@ describe Shoulda::Matchers::ActiveModel::ExceptionMessageFinder do
|
|||
|
||||
description = finder.source_description
|
||||
|
||||
description.should == 'exception'
|
||||
description.should eq 'exception'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -109,4 +109,3 @@ describe Shoulda::Matchers::ActiveModel::ExceptionMessageFinder do
|
|||
model_class.new(attribute => value)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ describe Shoulda::Matchers::ActiveModel::OddEvenNumberMatcher do
|
|||
|
||||
it 'returns itself when given a message' do
|
||||
matcher = new_odd_matcher
|
||||
matcher.with_message('some message').should == matcher
|
||||
matcher.with_message('some message').should eq matcher
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -19,7 +19,7 @@ describe Shoulda::Matchers::ActiveModel::OddEvenNumberMatcher do
|
|||
|
||||
it 'returns itself when given a message' do
|
||||
matcher = new_even_matcher
|
||||
matcher.with_message('some message').should == matcher
|
||||
matcher.with_message('some message').should eq matcher
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -85,7 +85,7 @@ describe Shoulda::Matchers::ActiveModel::OddEvenNumberMatcher do
|
|||
end.new
|
||||
end
|
||||
|
||||
def validating_even_number(options = {})
|
||||
def validating_even_number(options = {})
|
||||
define_model :example, :attr => :string do
|
||||
validates_numericality_of :attr, { :even => true }.merge(options)
|
||||
end.new
|
||||
|
|
|
@ -7,12 +7,12 @@ describe Shoulda::Matchers::ActiveModel::OnlyIntegerMatcher do
|
|||
end
|
||||
|
||||
it 'allows integer types' do
|
||||
new_matcher.allowed_types.should == 'integer'
|
||||
new_matcher.allowed_types.should eq 'integer'
|
||||
end
|
||||
|
||||
it 'returns itself when given a message' do
|
||||
matcher = new_matcher
|
||||
matcher.with_message('some message').should == matcher
|
||||
matcher.with_message('some message').should eq matcher
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
|||
describe Shoulda::Matchers::ActiveModel::ValidateConfirmationOfMatcher do
|
||||
context '#description' do
|
||||
it 'states that the confirmation must match its base attribute' do
|
||||
matcher.description.should == 'require attr_confirmation to match attr'
|
||||
matcher.description.should eq 'require attr_confirmation to match attr'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
|||
describe Shoulda::Matchers::ActiveModel::ValidateNumericalityOfMatcher do
|
||||
context '#description' do
|
||||
it 'states that it allows only numeric values' do
|
||||
matcher.description.should == 'only allow numeric values for attr'
|
||||
matcher.description.should eq 'only allow numeric values for attr'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ describe Shoulda::Matchers::ActiveModel::ValidateUniquenessOfMatcher do
|
|||
context 'without an existing record' do
|
||||
it 'does not require a created instance' do
|
||||
define_model_with_other
|
||||
Example.count.should == 0
|
||||
Example.count.should eq 0
|
||||
validating_uniqueness_with_other.should matcher
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ describe Shoulda::Matchers::ActiveModel::ValidationMessageFinder do
|
|||
|
||||
description = finder.allow_description('allowed values')
|
||||
|
||||
description.should == 'allow attr to be set to allowed values'
|
||||
description.should eq 'allow attr to be set to allowed values'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -17,7 +17,7 @@ describe Shoulda::Matchers::ActiveModel::ValidationMessageFinder do
|
|||
|
||||
message = finder.expected_message_from('some message')
|
||||
|
||||
message.should == 'some message'
|
||||
message.should eq 'some message'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -45,7 +45,7 @@ describe Shoulda::Matchers::ActiveModel::ValidationMessageFinder do
|
|||
|
||||
messages = finder.messages
|
||||
|
||||
messages.should == ['is invalid']
|
||||
messages.should eq ['is invalid']
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -60,7 +60,7 @@ describe Shoulda::Matchers::ActiveModel::ValidationMessageFinder do
|
|||
description = finder.messages_description
|
||||
|
||||
expected_messages = ['attr is invalid ("xyz")']
|
||||
description.should == "errors: #{expected_messages}"
|
||||
description.should eq "errors: #{expected_messages}"
|
||||
end
|
||||
|
||||
it 'describes errors when there are none' do
|
||||
|
@ -68,7 +68,7 @@ describe Shoulda::Matchers::ActiveModel::ValidationMessageFinder do
|
|||
|
||||
description = finder.messages_description
|
||||
|
||||
description.should == 'no errors'
|
||||
description.should eq 'no errors'
|
||||
end
|
||||
|
||||
it 'should not fetch attribute values for errors that were copied from an autosaved belongs_to association' do
|
||||
|
@ -80,7 +80,7 @@ describe Shoulda::Matchers::ActiveModel::ValidationMessageFinder do
|
|||
finder = Shoulda::Matchers::ActiveModel::ValidationMessageFinder.new(instance, :attribute)
|
||||
|
||||
expected_messages = ['association.association_attribute is invalid']
|
||||
finder.messages_description.should == "errors: #{expected_messages}"
|
||||
finder.messages_description.should eq "errors: #{expected_messages}"
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -91,7 +91,7 @@ describe Shoulda::Matchers::ActiveModel::ValidationMessageFinder do
|
|||
|
||||
description = finder.source_description
|
||||
|
||||
description.should == 'errors'
|
||||
description.should eq 'errors'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@ describe Shoulda::Matchers::ActiveRecord::AcceptNestedAttributesForMatcher do
|
|||
|
||||
matcher.matches?(rejecting_children).should be_false
|
||||
|
||||
matcher.failure_message_for_should.should == 'Expected Parent to accept nested attributes for children (is not declared)'
|
||||
matcher.failure_message_for_should.
|
||||
should eq 'Expected Parent to accept nested attributes for children (is not declared)'
|
||||
end
|
||||
|
||||
context 'allow_destroy' do
|
||||
|
|
Loading…
Reference in New Issue