aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Landauer <matthew@openaustralia.org>2013-01-29 10:37:32 +1100
committerMatthew Landauer <matthew@openaustralia.org>2013-01-29 10:37:32 +1100
commit7b1272cf2fe4ca6b209c8d1a3831ed59da0b2d46 (patch)
tree249c2c51a7895b7ab1a810de53cf932869cd7106
parente3f045826c0c48cbcffb94816028948784bfd4a3 (diff)
Copy basic_auth_login spec_helper from rspec 1 to 2
-rw-r--r--spec/spec_helper.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 75a5b5603..09a808061 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -98,3 +98,9 @@ def load_test_categories
[ "other", "Miscellaneous", "miscellaneous" ],])
end
+def basic_auth_login(request, username = nil, password = nil)
+ username = Configuration::admin_username if username.nil?
+ password = Configuration::admin_password if password.nil?
+ request.env["HTTP_AUTHORIZATION"] = "Basic " + Base64::encode64("#{username}:#{password}")
+end
+