spec/ramaze/params.rb in Pistos-ramaze-2009.04.08 vs spec/ramaze/params.rb in Pistos-ramaze-2009.06.12

- old
+ new

@@ -1,9 +1,9 @@ # Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com # All files in this distribution are subject to the terms of the Ruby license. -require 'spec/helper' +require File.expand_path('../../../spec/helper', __FILE__) class TCParamsController < Ramaze::Controller map '/' def index @@ -49,11 +49,11 @@ def add(one, two = nil, three = nil) "#{one}:#{two}:#{three}" end def keys - request.params.keys.to_s.dump + request.params.keys.inspect end end class TCParamsController3 < Ramaze::Controller map '/ma' @@ -62,11 +62,11 @@ request.params['foo'].to_s.dump end end describe "Simple Parameters" do - behaves_like :mock + behaves_like :rack_test def handle(*url) Ramaze::Mock.get(*url).body end @@ -101,12 +101,11 @@ it "action that takes all params but needs at least one" do handle('/at_least_one/foo/bar/foobar').should == "at least one (foo, bar, foobar)" end it "action that takes all params but needs at least one (not given here)" do - lambda{ handle('/at_least_one') }. - should.raise(ArgumentError) + lambda{ handle('/at_least_one') }.should.raise(ArgumentError) end it "one default" do handle('/one_default').should == "one_default (default)" end @@ -147,8 +146,8 @@ it 'should have a parameter via QUERY_PARAMS' do handle('/ma?foo=bar').should == '"bar"' end it 'should handle valueless params' do - handle('/jo/keys?foo').should == '"foo"' + handle('/jo/keys?foo').should == '["foo"]' end end