Got rid of deprecation messages due to usage of be_true and be_false

This commit is contained in:
Kristijan Novoselić 2015-03-17 14:15:41 +01:00
parent a04acec0da
commit 1f43e0d4d8
2 changed files with 12 additions and 12 deletions

View File

@ -16,14 +16,14 @@ describe Mongoid::Enum::Validators::MultipleValidator do
context "and value is nil" do context "and value is nil" do
before(:each) { validator.validate_each(record, attribute, nil) } before(:each) { validator.validate_each(record, attribute, nil) }
it "validates" do it "validates" do
expect(record.errors[attribute].empty?).to be_true expect(record.errors[attribute].empty?).to be true
end end
end end
context "and value is []" do context "and value is []" do
before(:each) { validator.validate_each(record, attribute, []) } before(:each) { validator.validate_each(record, attribute, []) }
it "validates" do it "validates" do
expect(record.errors[attribute].empty?).to be_true expect(record.errors[attribute].empty?).to be true
end end
end end
end end
@ -32,14 +32,14 @@ describe Mongoid::Enum::Validators::MultipleValidator do
context "and value is nil" do context "and value is nil" do
before(:each) { validator.validate_each(record, attribute, nil) } before(:each) { validator.validate_each(record, attribute, nil) }
it "won't validate" do it "won't validate" do
expect(record.errors[attribute].any?).to be_true expect(record.errors[attribute].any?).to be true
expect(record.errors[attribute]).to eq ["is not in #{values.join ", "}"] expect(record.errors[attribute]).to eq ["is not in #{values.join ", "}"]
end end
end end
context "and value is []" do context "and value is []" do
before(:each) { validator.validate_each(record, attribute, []) } before(:each) { validator.validate_each(record, attribute, []) }
it "won't validate" do it "won't validate" do
expect(record.errors[attribute].any?).to be_true expect(record.errors[attribute].any?).to be true
expect(record.errors[attribute]).to eq ["is not in #{values.join ", "}"] expect(record.errors[attribute]).to eq ["is not in #{values.join ", "}"]
end end
end end
@ -49,7 +49,7 @@ describe Mongoid::Enum::Validators::MultipleValidator do
let(:allow_nil) { rand(2).zero? } let(:allow_nil) { rand(2).zero? }
before(:each) { validator.validate_each(record, attribute, [values.sample]) } before(:each) { validator.validate_each(record, attribute, [values.sample]) }
it "validates" do it "validates" do
expect(record.errors[attribute].empty?).to be_true expect(record.errors[attribute].empty?).to be true
end end
end end
@ -57,7 +57,7 @@ describe Mongoid::Enum::Validators::MultipleValidator do
let(:allow_nil) { rand(2).zero? } let(:allow_nil) { rand(2).zero? }
before(:each) { validator.validate_each(record, attribute, [:amet]) } before(:each) { validator.validate_each(record, attribute, [:amet]) }
it "won't validate" do it "won't validate" do
expect(record.errors[attribute].any?).to be_true expect(record.errors[attribute].any?).to be true
end end
end end
@ -65,7 +65,7 @@ describe Mongoid::Enum::Validators::MultipleValidator do
let(:allow_nil) { rand(2).zero? } let(:allow_nil) { rand(2).zero? }
before(:each) { validator.validate_each(record, attribute, [values.first, values.last]) } before(:each) { validator.validate_each(record, attribute, [values.first, values.last]) }
it "validates" do it "validates" do
expect(record.errors[attribute].empty?).to be_true expect(record.errors[attribute].empty?).to be true
end end
end end
@ -73,7 +73,7 @@ describe Mongoid::Enum::Validators::MultipleValidator do
let(:allow_nil) { rand(2).zero? } let(:allow_nil) { rand(2).zero? }
before(:each) { validator.validate_each(record, attribute, [values.first, values.last, :amet]) } before(:each) { validator.validate_each(record, attribute, [values.first, values.last, :amet]) }
it "won't validate" do it "won't validate" do
expect(record.errors[attribute].any?).to be_true expect(record.errors[attribute].any?).to be true
end end
end end
end end

View File

@ -56,7 +56,7 @@ describe Mongoid::Enum do
end end
end end
describe "accessors"do describe "accessors" do
context "when singular" do context "when singular" do
describe "{{value}}!" do describe "{{value}}!" do
it "sets the value" do it "sets the value" do
@ -111,15 +111,15 @@ describe Mongoid::Enum do
instance.save instance.save
instance.author! instance.author!
instance.editor! instance.editor!
expect(instance.editor?).to be_true expect(instance.editor?).to be true
expect(instance.author?).to be_true expect(instance.author?).to be true
end end
end end
context "when {{enum}} does not contain {{value}}" do context "when {{enum}} does not contain {{value}}" do
it "returns false" do it "returns false" do
instance.save instance.save
expect(instance.author?).to be_false expect(instance.author?).to be false
end end
end end
end end