@@ -657,7 +657,7 @@ class TwitterAPI < Grape::API
657657 TwitterAPI ::versions . should == [ 'v1' , 'v2' ]
658658 end
659659 it "should set route paths" do
660- TwitterAPI ::routes . size . should = = 2
660+ TwitterAPI ::routes . size . should > = 2
661661 TwitterAPI ::routes [ 0 ] . route_path . should == "/:version/version(.:format)"
662662 TwitterAPI ::routes [ 1 ] . route_path . should == "/p/:version/n1/n2/version(.:format)"
663663 end
@@ -679,12 +679,12 @@ class TwitterAPI < Grape::API
679679 end
680680 end
681681 it "should split a string" do
682- get "/split/a,b,c" , :token => ','
683- last_response . body . should == '["a", "b", "c"]'
682+ get "/split/a,b,c.json " , :token => ','
683+ last_response . body . should == '["a","b","c"]'
684684 end
685685 it "should split a string with limit" do
686- get "/split/a,b,c" , :token => ',' , :limit => '2'
687- last_response . body . should == '["a", "b,c"]'
686+ get "/split/a,b,c.json " , :token => ',' , :limit => '2'
687+ last_response . body . should == '["a","b,c"]'
688688 end
689689 it "should set route_params" do
690690 subject . routes . size . should == 1
@@ -697,43 +697,43 @@ class TwitterAPI < Grape::API
697697 describe ".rescue_from klass, block" do
698698 it 'should rescue Exception' do
699699 subject . rescue_from RuntimeError do |e |
700- rack_response ( { :message => "rescued from #{ e . message } " } , 202 )
700+ rack_response ( "rescued from #{ e . message } " , 202 )
701701 end
702702 subject . get '/exception' do
703703 raise "rain!"
704704 end
705705 get '/exception'
706706 last_response . status . should eql 202
707- last_response . body . should == '{:message=>" rescued from rain!"} '
707+ last_response . body . should == 'rescued from rain!'
708708 end
709709 it 'should rescue an error via rescue_from :all' do
710710 class ConnectionError < RuntimeError ; end
711711 subject . rescue_from :all do |e |
712- rack_response ( { :message => "rescued from #{ e . class . name } " } , 500 )
712+ rack_response ( "rescued from #{ e . class . name } " , 500 )
713713 end
714714 subject . get '/exception' do
715715 raise ConnectionError
716716 end
717717 get '/exception'
718718 last_response . status . should eql 500
719- last_response . body . should == '{:message=>" rescued from ConnectionError"} '
719+ last_response . body . should == 'rescued from ConnectionError'
720720 end
721721 it 'should rescue a specific error' do
722722 class ConnectionError < RuntimeError ; end
723723 subject . rescue_from ConnectionError do |e |
724- rack_response ( { :message => "rescued from #{ e . class . name } " } , 500 )
724+ rack_response ( "rescued from #{ e . class . name } " , 500 )
725725 end
726726 subject . get '/exception' do
727727 raise ConnectionError
728728 end
729729 get '/exception'
730730 last_response . status . should eql 500
731- last_response . body . should == '{:message=>" rescued from ConnectionError"} '
731+ last_response . body . should == 'rescued from ConnectionError'
732732 end
733733 it 'should not rescue a different error' do
734734 class CommunicationError < RuntimeError ; end
735735 subject . rescue_from RuntimeError do |e |
736- rack_response ( { :message => "rescued from #{ e . class . name } " } , 500 )
736+ rack_response ( "rescued from #{ e . class . name } " , 500 )
737737 end
738738 subject . get '/uncaught' do
739739 raise CommunicationError
0 commit comments