Sha256: 6b66c8e508931194f88cf5f91af8669d1b8c97fbbb574546daad5ed9bfaf939e

Contents?: true

Size: 605 Bytes

Versions: 5

Compression:

Stored size: 605 Bytes

Contents

require 'spec_helper'

module ApiTaster
  describe RouteCollector do
    before(:all) do
      Rails.application.routes.draw do
        resources :dummy_users
      end
      Route.map_routes "#{Rails.root}/lib/api_tasters/route_collector"
    end

    it "gets users" do
      route = Route.find_by_verb_and_path(:get, '/dummy_users/:id')
      Route.supplied_params[route[:id]].should == [{ :id => 42 }]
    end

    it "posts a new user" do
      route = Route.find_by_verb_and_path(:post, '/dummy_users')
      Route.supplied_params[route[:id]].should == [{}, { :hello => 'world' }]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
api_taster-0.8.4 spec/route_collector_spec.rb
api_taster-0.8.3 spec/route_collector_spec.rb
api_taster-0.8.2 spec/route_collector_spec.rb
api_taster-0.8.1 spec/route_collector_spec.rb
api_taster-0.7.0 spec/route_collector_spec.rb