Sha256: 8788be337ddb92e57a294aed0962c113a14e48ff43997b6a6ee9670a8300b9ef
Contents?: true
Size: 724 Bytes
Versions: 1
Compression:
Stored size: 724 Bytes
Contents
require File.expand_path("../lib/basica", File.dirname(__FILE__)) include Basica scope do setup do "Basic %s" % Base64.encode64("foo:bar") end test "correct credentials" do |header| result = basic_auth("HTTP_AUTHORIZATION" => header) do |user, pass| user == "foo" && pass == "bar" end assert_equal true, result end test "incorrect credentials" do |header| result = basic_auth("HTTP_AUTHORIZATION" => header) do |user, pass| user == "foo" && pass == "baz" end assert_equal false, result end test "bad request" do assert_raise RuntimeError do result = basic_auth(Hash.new) do |user, pass| user == "foo" && pass == "baz" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
basica-0.0.1 | test/basica_test.rb |