Skip to content

Commit

Permalink
Update Sequel to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Feb 25, 2020
1 parent 1e26621 commit 901056d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Gemfile.rails5.2
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ gem 'rspec', '~> 2.7.0'
gem 'mocha', '~> 0.9.8'

gem 'sqlite3', '~> 1.3.6'
gem 'sequel', '~> 3.8'
gem 'sequel', '~> 5.29'
gem 'dm-core'
gem 'dm-aggregates'
gem 'dm-migrations'
Expand Down
13 changes: 7 additions & 6 deletions spec/finders/sequel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
describe Sequel::Dataset::Pagination, 'extension' do

class Car < Sequel::Model
self.dataset = dataset.extension(:pagination)
end

it "should have the #paginate method" do
Car.should respond_to(:paginate)
Car.dataset.should respond_to(:paginate)
end

it "should NOT have the #paginate_by_sql method" do
Car.should_not respond_to(:paginate_by_sql)
Car.dataset.should_not respond_to(:paginate_by_sql)
end

describe 'pagination' do
Expand All @@ -29,7 +30,7 @@ class Car < Sequel::Model
end

it "should imitate WillPaginate::Collection" do
result = Car.paginate(1, 2)
result = Car.dataset.paginate(1, 2)

result.should_not be_empty
result.size.should == 2
Expand All @@ -41,16 +42,16 @@ class Car < Sequel::Model
end

it "should perform" do
Car.paginate(1, 2).all.should == [Car[1], Car[2]]
Car.dataset.paginate(1, 2).all.should == [Car[1], Car[2]]
end

it "should be empty" do
result = Car.paginate(3, 2)
result = Car.dataset.paginate(3, 2)
result.should be_empty
end

it "should perform with #select and #order" do
result = Car.select("name as foo".lit).order(:name).paginate(1, 2).all
result = Car.select(Sequel.lit("name as foo")).order(:name).paginate(1, 2).all
result.size.should == 2
result.first.values[:foo].should == "Aston Martin"
end
Expand Down

0 comments on commit 901056d

Please sign in to comment.