Sha256: 7548134d52332b7f25acbe60016fa8ddd247a826d0ed2da2a9f31502820b7dda
Contents?: true
Size: 1.47 KB
Versions: 3
Compression:
Stored size: 1.47 KB
Contents
require 'spec_helper' module ApiTaster describe Mapper do context "non-existing routes" do before(:all) do routes = ActionDispatch::Routing::RouteSet.new routes.draw do get '/awesome_route' => 'awesome#route' end ApiTaster.routes do get '/dummy_route' end Route.route_set = routes end it "records obsolete definitions" do Route.obsolete_definitions.first[:path].should == '/dummy_route' end end before(:all) do Rails.application.routes.draw { resources :dummy_users } ApiTaster.routes do get '/dummy_users/:id', :id => 1 post '/dummy_users' post '/dummy_users', { :hello => 'world' } put '/dummy_users/:id', :id => 2 delete '/dummy_users/:id', :id => 3 end end it "gets users" do route = Route.find_by_verb_and_path(:get, '/dummy_users/:id') Route.inputs[route[:id]].should == [{ :id => 1 }] end it "posts a new user" do route = Route.find_by_verb_and_path(:post, '/dummy_users') Route.inputs[route[:id]].should == [{}, { :hello => 'world' }] end it "edits a user" do route = Route.find_by_verb_and_path(:put, '/dummy_users/:id') Route.inputs[route[:id]].should == [{ :id => 2 }] end it "deletes a user" do route = Route.find_by_verb_and_path(:delete, '/dummy_users/:id') Route.inputs[route[:id]].should == [{ :id => 3 }] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
api_taster-0.4.2 | spec/mapper_spec.rb |
api_taster-0.4.1 | spec/mapper_spec.rb |
api_taster-0.4.0 | spec/mapper_spec.rb |