test/sinatra.rb in shield-0.1.0.rc1 vs test/sinatra.rb in shield-0.1.0

- old
+ new

@@ -1,20 +1,8 @@ require File.expand_path("helper", File.dirname(__FILE__)) -require "sinatra/base" +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 - class SinatraApp < Sinatra::Base enable :sessions helpers Shield::Helpers get "/public" do @@ -48,27 +36,10 @@ scope do def app SinatraApp.new 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 - - def debug - require "open3" - out, _, _ = Open3.capture3("elinks -dump", stdin_data: last_response.body) - puts out - end - setup do clear_cookies end test "public" do @@ -111,6 +82,6 @@ get "/logout" assert_equal nil, session[:remember_for] end -end \ No newline at end of file +end