test/cuba.rb in shield-0.1.0.rc1 vs test/cuba.rb in shield-0.1.0
- old
+ new
@@ -1,23 +1,11 @@
require File.expand_path("helper", File.dirname(__FILE__))
+require File.expand_path("user", File.dirname(__FILE__))
-class User < Struct.new(:id)
- extend Shield::Model
-
- def self.[](id)
- User.new(1) unless id.to_s.empty?
- end
-
- def self.authenticate(username, password)
- User.new(1001) if username == "quentin" && password == "password"
- end
-end
-
Cuba.use Rack::Session::Cookie
+Cuba.plugin Shield::Helpers
-Cuba.send :include, Shield::Helpers
-
Cuba.define do
on get, "public" do
res.write "Public"
end
@@ -46,20 +34,9 @@
end
scope do
def app
Cuba
- end
-
- def assert_redirected_to(path)
- unless last_response.status == 302
- flunk
- end
- assert_equal path, URI(last_response.headers["Location"]).path
- end
-
- def session
- last_request.env["rack.session"]
end
setup do
clear_cookies
end