Skip to content

Commit

Permalink
Merge pull request #60 from treasure-data/fix_test
Browse files Browse the repository at this point in the history
Fix test cases
  • Loading branch information
yui-knk authored Jan 22, 2020
2 parents 50b2e2a + 2b65462 commit 01fa867
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
rvm:
- 1.9.3
- 2.0.0
- 2.1.7
- 2.2.3
- 2.3.1
- 2.4.0
- 2.3.8
- 2.4.9
- 2.5.7
- 2.6.5

script: "bundle exec rake spec"

Expand Down
4 changes: 1 addition & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ require 'rake/clean'

require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec) do |t|
t.fail_on_error = false
end
RSpec::Core::RakeTask.new(:spec)

task :default => [:spec, :build]

Expand Down
42 changes: 25 additions & 17 deletions spec/statement_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,32 @@
retry_p.should be_true
end

it "decodes DeleteHandle" do
dh = Models::DeleteHandle.decode({
"handle" => {
"connectorId" => "c1",
"connectorHandle" => {}
}
})
dh.handle.should be_a_kind_of Models::TableHandle
dh.handle.connector_id.should == "c1"
dh.handle.connector_handle.should == {}
end

it "validates models" do
lambda do
Models::DeleteHandle.decode({
"handle" => "invalid"
# presto version could be "V0_ddd" or "Vddd"
/\APresto::Client::ModelVersions::V(\w+)/ =~ Presto::Client::Models.to_s

# https://github.com/prestosql/presto/commit/80a2c5113d47e3390bf6dc041486a1c9dfc04592
# renamed DeleteHandle to DeleteTarget, then DeleteHandle exists when presto version
# is less than 313.
if $1[0, 2] == "0_" || $1.to_i < 314
it "decodes DeleteHandle" do
dh = Models::DeleteHandle.decode({
"handle" => {
"connectorId" => "c1",
"connectorHandle" => {}
}
})
end.should raise_error(TypeError, /String to Hash/)
dh.handle.should be_a_kind_of Models::TableHandle
dh.handle.connector_id.should == "c1"
dh.handle.connector_handle.should == {}
end

it "validates models" do
lambda do
Models::DeleteHandle.decode({
"handle" => "invalid"
})
end.should raise_error(TypeError, /String to Hash/)
end
end

it "receives headers of POST" do
Expand Down

0 comments on commit 01fa867

Please sign in to comment.