Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
More fixes for 1.8 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
timcraft committed Nov 16, 2012
1 parent 5a637ee commit 11f6b13
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/nexmo.rb
@@ -1,4 +1,5 @@
require 'net/http'
require 'net/https' if RUBY_VERSION == '1.8.7'
require 'json'
require 'cgi'

Expand Down
6 changes: 6 additions & 0 deletions nexmo.gemspec
Expand Up @@ -8,7 +8,13 @@ Gem::Specification.new do |s|
s.description = 'A simple wrapper for the Nexmo API'
s.summary = 'See description'
s.files = Dir.glob('{lib,spec}/**/*') + %w(README.md nexmo.gemspec)
s.add_development_dependency('rake', '>= 0.9.3')
s.add_development_dependency('mocha', '~> 0.9.12')
s.add_development_dependency('oj', '~> 1.3.7')
s.require_path = 'lib'

if RUBY_VERSION == '1.8.7'
s.add_development_dependency('minitest', '>= 4.2.0')
s.add_development_dependency('json', '>= 1.6.5')
end
end
10 changes: 5 additions & 5 deletions spec/nexmo_spec.rb
Expand Up @@ -2,7 +2,7 @@
require 'mocha'
require 'oj'

require_relative '../lib/nexmo'
require 'nexmo'

describe 'Nexmo::Client' do
before do
Expand Down Expand Up @@ -94,7 +94,7 @@

describe 'get_account_numbers method' do
it 'fetches the account numbers resource with the given parameters and returns a response object' do
@client.http.expects(:get).with('/account/numbers/key/secret?size=25&pattern=33').returns(stub)
@client.http.expects(:get).with(has_equivalent_query_string('/account/numbers/key/secret?size=25&pattern=33')).returns(stub)

@client.get_account_numbers(:size => 25, :pattern => 33).must_be_instance_of(Nexmo::Response)
end
Expand Down Expand Up @@ -126,13 +126,13 @@

describe 'search_messages method' do
it 'fetches the search messages resource with the given parameters and returns a response object' do
@client.http.expects(:get).with('/search/messages/key/secret?date=YYYY-MM-DD&to=1234567890').returns(stub)
@client.http.expects(:get).with(has_equivalent_query_string('/search/messages/key/secret?date=YYYY-MM-DD&to=1234567890')).returns(stub)

@client.search_messages(:date => 'YYYY-MM-DD', :to => 1234567890).must_be_instance_of(Nexmo::Response)
end

it 'should encode a non hash argument as a list of ids' do
@client.http.expects(:get).with('/search/messages/key/secret?ids=id1&ids=id2').returns(stub)
@client.http.expects(:get).with(has_equivalent_query_string('/search/messages/key/secret?ids=id1&ids=id2')).returns(stub)

@client.search_messages(%w(id1 id2))
end
Expand All @@ -149,7 +149,7 @@
it 'delegates to the underlying http response' do
@http_response.expects(:code).returns('200')

@response.must_respond_to(:code)
@response.must_respond_to(:code) unless RUBY_VERSION == '1.8.7'
@response.code.must_equal('200')
end

Expand Down

0 comments on commit 11f6b13

Please sign in to comment.