Sha256: b96f6eb61d6e38563eb39d333834900216340e27fb6e2a46090ab920a8ddf367

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

require_relative './test_helper'
require "minitest/autorun"
require "wonder_ways"

class WonderWaysTest < Minitest::Unit::TestCase
  attr_reader :wonder_ways

  def setup
    @wonder_ways = WonderWays.new 'http://localhost:3000'
  end

  def test_it_can_list_trails
    VCR.use_cassette("list_trails") do
      trails = wonder_ways.list_trails(1)
      assert_equal 30, trails.count
      first_trail = trails.first
      assert first_trail.name
      assert first_trail.city
      assert first_trail.state
    end
  end

  def test_it_can_find_trail_by_id
    VCR.use_cassette("find_trail_by_id") do
      trail = wonder_ways.find_trail(1)
      assert trail.name
      assert trail.city
      assert trail.state
    end
  end

  def test_it_can_search_trails_by_state
    VCR.use_cassette("list_trails_by_state") do
      trails = wonder_ways.search_trails_by_state("CO")
      assert trails
      first_trail = trails.first
      assert first_trail.name
      assert first_trail.city
      assert_equal "Colorado", first_trail.state
    end
  end

  def test_it_can_search_trails_by_location
    VCR.use_cassette("list_trails_by_location") do
      trails = wonder_ways.search_trails_by_location(38.3, -106.6)
      assert trails
      first_trail = trails.first
      assert first_trail.name
      assert first_trail.city
      assert_equal "Colorado", first_trail.state
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wonder_ways-1.0.0 test/wonder_ways_test.rb