Sha256: 92d82144149071cf1d88375eacd1ba65e3289a97aedd985023affb355b659d4d
Contents?: true
Size: 995 Bytes
Versions: 1
Compression:
Stored size: 995 Bytes
Contents
require 'test/unit' require 'mocha/setup' require 'strava/v2/connection' require 'strava/exceptions' class V2ConnectionTest < Test::Unit::TestCase def setup @relative_uri = "made_up_uri" @s = Strava::V2::Connection.new end def test_creatable assert @s.is_a?(Strava::V2::Connection) end def test_valid_response_code Strava::V2::Connection.stubs(:get).with("/#{@relative_uri}", :query => nil) .returns(stub(:code => 200, :parsed_response => {:stuff => "other stuff"})) @s.fetch(@relative_uri, nil) end def test_unsupported_uri_scheme Strava::V2::Connection.stubs(:get).raises(HTTParty::UnsupportedURIScheme.new) assert_raise Strava::RequestError do @s.fetch(@relative_uri, nil) end end def test_strava_error_response_code Strava::V2::Connection.stubs(:get).with("/#{@relative_uri}", :query => nil) .returns(stub(:code => 500)) assert_raise Strava::StravaError do @s.fetch(@relative_uri, nil) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
strava-api-v2-0.1 | test/v2_connection_test.rb |