-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AR, DM, Mongoid, MongoMapper].each {|orm| run orm specs only if orm …
…is loaded }
- Loading branch information
Showing
6 changed files
with
554 additions
and
540 deletions.
There are no files selected for viewing
42 changes: 22 additions & 20 deletions
42
spec/models/active_record/active_record_relation_methods_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,32 @@ | ||
require 'spec_helper' | ||
|
||
describe 'default per_page' do | ||
describe 'AR::Base' do | ||
subject { ActiveRecord::Base } | ||
it { should_not respond_to :paginates_per } | ||
end | ||
if defined? ActiveRecord | ||
|
||
subject { User.page 0 } | ||
describe 'default per_page' do | ||
describe 'AR::Base' do | ||
subject { ActiveRecord::Base } | ||
it { should_not respond_to :paginates_per } | ||
end | ||
|
||
context 'by default' do | ||
its(:limit_value) { should == 25 } | ||
end | ||
subject { User.page 0 } | ||
|
||
context 'when explicitly set via paginates_per' do | ||
before { User.paginates_per 1326 } | ||
its(:limit_value) { should == 1326 } | ||
after { User.paginates_per nil } | ||
end | ||
context 'by default' do | ||
its(:limit_value) { should == 25 } | ||
end | ||
|
||
describe "default per_page value's independency per model" do | ||
context "when User's default per_page was changed" do | ||
context 'when explicitly set via paginates_per' do | ||
before { User.paginates_per 1326 } | ||
subject { Book.page 0 } | ||
its(:limit_value) { should == 25 } | ||
its(:limit_value) { should == 1326 } | ||
after { User.paginates_per nil } | ||
end | ||
|
||
describe "default per_page value's independency per model" do | ||
context "when User's default per_page was changed" do | ||
before { User.paginates_per 1326 } | ||
subject { Book.page 0 } | ||
its(:limit_value) { should == 25 } | ||
after { User.paginates_per nil } | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.