Sha256: 53770b28bd7f02ffd402c452ef8d58f6ad3ca6f2e978fe3c709d0aae4b6894e0
Contents?: true
Size: 753 Bytes
Versions: 12
Compression:
Stored size: 753 Bytes
Contents
require 'test_helper' require 'rack/test' class IdentityMapMiddlewareTest < Test::Unit::TestCase include Rack::Test::Methods def app @app ||= Rack::Builder.new do use MongoMapper::Middleware::IdentityMap map "/" do run lambda {|env| [200, {}, []] } end map "/fail" do run lambda {|env| raise "FAIL!" } end end.to_app end context "with a successful request" do should "clear the identity map" do MongoMapper::Plugins::IdentityMap.expects(:clear).twice get '/' end end context "when the request raises an error" do should "clear the identity map" do MongoMapper::Plugins::IdentityMap.expects(:clear).twice get '/fail' rescue nil end end end
Version data entries
12 entries across 12 versions & 4 rubygems