spec/extensions/boolean_readers_spec.rb in sequel-4.22.0 vs spec/extensions/boolean_readers_spec.rb in sequel-4.23.0
- old
+ new
@@ -14,80 +14,80 @@
def columns; @columns; end
end
@c.instance_eval(&@p)
end
- specify "should create attribute? readers for all boolean attributes" do
+ it "should create attribute? readers for all boolean attributes" do
@c.plugin(:boolean_readers)
o = @c.new
- o.b?.should == nil
+ o.b?.must_equal nil
o.b = '1'
- o.b?.should == true
+ o.b?.must_equal true
o.b = '0'
- o.b?.should == false
+ o.b?.must_equal false
o.b = ''
- o.b?.should == nil
+ o.b?.must_equal nil
end
- specify "should not create attribute? readers for non-boolean attributes" do
+ it "should not create attribute? readers for non-boolean attributes" do
@c.plugin(:boolean_readers)
- proc{@c.new.z?}.should raise_error(NoMethodError)
- proc{@c.new.id?}.should raise_error(NoMethodError)
+ proc{@c.new.z?}.must_raise(NoMethodError)
+ proc{@c.new.id?}.must_raise(NoMethodError)
end
- specify "should accept a block to determine if an attribute is boolean" do
+ it "should accept a block to determine if an attribute is boolean" do
@c.plugin(:boolean_readers){|c| db_schema[c][:db_type] == 'tinyint(1)'}
- proc{@c.new.b?}.should raise_error(NoMethodError)
+ proc{@c.new.b?}.must_raise(NoMethodError)
o = @c.new
- o.z.should == nil
- o.z?.should == nil
+ o.z.must_equal nil
+ o.z?.must_equal nil
o.z = '1'
- o.z.should == 1
- o.z?.should == true
+ o.z.must_equal 1
+ o.z?.must_equal true
o.z = '0'
- o.z.should == 0
- o.z?.should == false
+ o.z.must_equal 0
+ o.z?.must_equal false
o.z = ''
- o.z.should == nil
- o.z?.should == nil
+ o.z.must_equal nil
+ o.z?.must_equal nil
end
- specify "should create boolean readers when set_dataset is defined" do
+ it "should create boolean readers when set_dataset is defined" do
c = Class.new(Sequel::Model(@db))
c.instance_eval(&@p)
c.plugin(:boolean_readers)
c.set_dataset(@db[:a])
o = c.new
- o.b?.should == nil
+ o.b?.must_equal nil
o.b = '1'
- o.b?.should == true
+ o.b?.must_equal true
o.b = '0'
- o.b?.should == false
+ o.b?.must_equal false
o.b = ''
- o.b?.should == nil
- proc{o.i?}.should raise_error(NoMethodError)
+ o.b?.must_equal nil
+ proc{o.i?}.must_raise(NoMethodError)
c = Class.new(Sequel::Model(@db))
c.instance_eval(&@p)
c.plugin(:boolean_readers){|x| db_schema[x][:db_type] == 'tinyint(1)'}
c.set_dataset(@db[:a])
o = c.new
- o.z.should == nil
- o.z?.should == nil
+ o.z.must_equal nil
+ o.z?.must_equal nil
o.z = '1'
- o.z.should == 1
- o.z?.should == true
+ o.z.must_equal 1
+ o.z?.must_equal true
o.z = '0'
- o.z.should == 0
- o.z?.should == false
+ o.z.must_equal 0
+ o.z?.must_equal false
o.z = ''
- o.z.should == nil
- o.z?.should == nil
- proc{o.b?}.should raise_error(NoMethodError)
+ o.z.must_equal nil
+ o.z?.must_equal nil
+ proc{o.b?}.must_raise(NoMethodError)
end
- specify "should handle cases where getting the columns raises an error" do
+ it "should handle cases where getting the columns raises an error" do
@c.meta_def(:columns){raise Sequel::Error}
- proc{@c.plugin(:boolean_readers)}.should_not raise_error
- proc{@c.new.b?}.should raise_error(NoMethodError)
+ @c.plugin(:boolean_readers)
+ proc{@c.new.b?}.must_raise(NoMethodError)
end
end