spec/paginate/base_spec.rb in paginate-1.0.1 vs spec/paginate/base_spec.rb in paginate-2.0.0
- old
+ new
@@ -1,60 +1,62 @@
require "spec_helper"
describe Paginate::Base do
- it "should return page from integer" do
- Paginate::Base.new(12).page.should == 12
+ it "returns page from integer" do
+ expect(Paginate::Base.new(12).page).to eql(12)
end
- it "should return page from string" do
- Paginate::Base.new("12").page.should == 12
+ it "returns page from string" do
+ expect(Paginate::Base.new("12").page).to eql(12)
end
- it "should default to page 1" do
- Paginate::Base.new.page == 1
+ it "defaults to page 1" do
+ expect(Paginate::Base.new.page).to eql(1)
end
- it "should return page from options" do
- Paginate::Base.new(:page => 12).page == 12
+ it "returns page from options" do
+ expect(Paginate::Base.new(:page => 12).page).to eql(12)
end
- it "should return limit from configuration" do
+ it "returns limit from configuration" do
Paginate::Config.size = 25
- Paginate::Base.new.limit.should == 26
+ expect(Paginate::Base.new.limit).to eql(26)
end
- it "should return limit from options" do
+ it "returns limit from options" do
Paginate::Config.size = 25
- Paginate::Base.new(:size => 13).limit.should == 14
+ expect(Paginate::Base.new(:size => 13).limit).to eql(14)
end
- it "should return default limit" do
+ it "returns default limit" do
Paginate::Config.size = nil
- Paginate::Base.new.limit.should == 11
+ expect(Paginate::Base.new.limit).to eql(11)
end
- it "should return offset from configuration" do
+ it "returns offset from configuration" do
Paginate::Config.size = 15
- Paginate::Base.new(:page => 2).offset.should == 15
+ expect(Paginate::Base.new(:page => 2).offset).to eql(15)
end
- it "should return offset from options" do
- Paginate::Base.new(:page => 2, :size => 5).offset.should == 5
+ it "returns offset from options" do
+ expect(Paginate::Base.new(:page => 2, :size => 5).offset).to eql(5)
end
- it "should return finder options" do
+ it "returns finder options" do
actual = Paginate::Base.new(:page => 3, :size => 5).to_options
expected = {:limit => 6, :offset => 10}
- actual.should == expected
+ expect(actual).to eql(expected)
end
specify {
- Paginate::Base.new(:page => 1, :size => 5, :collection => Array.new(6)).should have_next_page
+ Paginate::Base.new(:page => 1, :size => 5, :collection => Array.new(6))
+ .should have_next_page
}
specify {
- Paginate::Base.new(:page => 1, :size => 5, :collection => Array.new(5)).should_not have_next_page
+ Paginate::Base.new(:page => 1, :size => 5, :collection => Array.new(5))
+ .should_not have_next_page
}
specify {
Paginate::Base.new(:page => 2).should have_previous_page
}