spec/rackamole/mole_spec.rb in rackamole-0.2.9 vs spec/rackamole/mole_spec.rb in rackamole-0.3.0

- old
+ new

@@ -281,9 +281,23 @@ res = rack.send( :get_route, OpenStruct.new( :path => "/", :request_method => "GET") ) res.should_not be_nil res[:controller].should == 'fred' res[:action].should == 'blee' end + + it "should extract request parameters correctly" do + rack = Rack::Mole.new( nil, :app_name => "test app" ) + res = rack.send( :params_from_route, {:controller => "blee", :action => "fred", :bobo => "hello" } ) + res.should_not be_nil + res.should have(1).item + res.should == { :bobo => "hello" } + end + + it "should not pick up params if none are specified" do + rack = Rack::Mole.new( nil, :app_name => "test app" ) + res = rack.send( :params_from_route, {:controller => "blee", :action => "fred" } ) + res.should be_empty + end end # --------------------------------------------------------------------------- describe 'sending alerts' do it "should send out alerts on the first occurrance of a perf issue" do