Sha256: 885b5cf4e0983a16e603f66aedc51208333fae35b193bb504792ab27e52a5f35

Contents?: true

Size: 663 Bytes

Versions: 13

Compression:

Stored size: 663 Bytes

Contents

require 'test_helper'

module Spyke
  class PathTest < MiniTest::Test
    def test_collection_path
      assert_equal '/recipes', Path.new('/recipes/:id').to_s
    end

    def test_resource_path
      assert_equal '/recipes/2', Path.new('/recipes/:id', id: 2).to_s
    end

    def test_nested_collection_path
      path = Path.new('/users/:user_id/recipes/:id', user_id: 1, status: 'published')
      assert_equal [:user_id, :id], path.variables
      assert_equal '/users/1/recipes', path.to_s
    end

    def test_nested_resource_path
      assert_equal '/users/1/recipes/2', Path.new('/users/:user_id/recipes/:id', user_id: 1, id: 2).to_s
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
spyke-1.6.0 test/path_test.rb
spyke-1.5.0 test/path_test.rb
spyke-1.4.1 test/path_test.rb
spyke-1.4.0 test/path_test.rb
spyke-1.3.0 test/path_test.rb
spyke-1.2.1 test/path_test.rb
spyke-1.2.0 test/path_test.rb
spyke-1.1.2 test/path_test.rb
spyke-1.1.1 test/path_test.rb
spyke-1.1.0 test/path_test.rb
spyke-1.0.2 test/path_test.rb
spyke-1.0.1 test/path_test.rb
spyke-1.0.0 test/path_test.rb