Sha256: 6f66b872cdfc7ad22504d0b60c74cb8f4d6f19d47c8601beb41a4cc9ae540b4f

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

require 'test/unit'
require 'mocha/setup'
require 'strava/v2/connection'
require 'strava/exceptions'
require 'strava/v2/models/athlete'
require 'json'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'test'))
require 'test_data'

class EffortsV2Test < Test::Unit::TestCase

  def setup
    @s = Strava::V2::Connection.new
  end

  def test_get_efforts_for_ride
    ride_id = 448459
    Strava::V2::Connection.stubs(:get)
    .with("/rides/#{ride_id}/efforts", {:query => {}})
    .returns(stub(:code => 200, :parsed_response => (JSON.parse TestData.test_v2_efforts)))
    segments = @s.segments_for_ride(ride_id)
    effort = segments[0].efforts[0]
    assert effort.is_a?(Strava::V2::Effort)
    assert_equal(45665444, effort.id)
    assert_equal(12, segments.length)
    assert_equal(634, effort.elapsed_time)
    assert_equal(634, effort.moving_time)
    assert_equal(5342.8, effort.distance)
    assert_equal(852034, segments[0].id)
    assert_equal(1, segments[0].climb_category)
    assert_equal([37.771132132038474,-122.45532101020217], segments[0].start_latlng)
    assert_equal(-0.997671, segments[0].average_grade)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
strava-api-v2-0.1 test/efforts_v2_test.rb