-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a small spec suite for code not covered by Sequel's tests, to get to 100% line/branch coverage of the Ruby code. Add nocov markers around code for older versions of Sequel.
- Loading branch information
1 parent
0fac9b1
commit a481897
Showing
7 changed files
with
88 additions
and
6 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
/tmp | ||
/lib/*.so | ||
*.gem | ||
*.rbc | ||
/coverage |
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
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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
require 'simplecov' | ||
|
||
SimpleCov.start do | ||
enable_coverage :branch | ||
command_name ENV['SIMPLECOV_COMMAND_NAME'] | ||
root File.dirname(__dir__) | ||
add_filter "/spec/" | ||
add_group('Missing'){|src| src.covered_percent < 100} | ||
add_group('Covered'){|src| src.covered_percent == 100} | ||
end |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
gem 'minitest' | ||
ENV['MT_NO_PLUGINS'] = '1' # Work around stupid autoloading of plugins | ||
require 'minitest/global_expectations/autorun' | ||
|
||
require 'sequel/core' | ||
|
||
Sequel.extension :pg_array | ||
db = Sequel.connect(ENV['SEQUEL_PG_SPEC_URL'] || 'postgres:///?user=sequel_test') | ||
db.extension :pg_streaming | ||
Sequel::Deprecation.output = false | ||
|
||
describe 'sequel_pg' do | ||
it "should support deprecated optimized_model_load methods" do | ||
db.optimize_model_load.must_equal true | ||
db.optimize_model_load = false | ||
db.optimize_model_load.must_equal true | ||
|
||
ds = db.dataset | ||
ds.optimize_model_load.must_equal true | ||
proc{ds.optimize_model_load = false}.must_raise FrozenError | ||
ds.with_optimize_model_load(false).optimize_model_load.must_equal false | ||
end | ||
|
||
it "should have working Sequel::Postgres::PGArray::Creator#call" do | ||
Sequel::Postgres::PGArray::Creator.new('text').call('{1}').must_equal ["1"] | ||
end | ||
|
||
it "should raise for map with symbol and block" do | ||
proc{db.dataset.map(:x){}}.must_raise Sequel::Error | ||
end | ||
|
||
it "should support paged_each with and without streaming" do | ||
a = [] | ||
db.select(Sequel.as(1, :v)).paged_each{|row| a << row} | ||
a.must_equal [{:v=>1}] | ||
|
||
a = [] | ||
db.select(Sequel.as(1, :v)).stream.paged_each{|row| a << row} | ||
a.must_equal [{:v=>1}] | ||
end | ||
end |