2008-10-17 15:43:14 +00:00
|
|
|
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
|
|
|
|
|
|
|
describe "Basic Auth HTTP headers" do
|
|
|
|
before do
|
2008-11-23 05:22:49 +00:00
|
|
|
basic_auth('user', 'secret')
|
2008-10-17 15:43:14 +00:00
|
|
|
end
|
|
|
|
|
2008-11-05 23:20:27 +00:00
|
|
|
it "should be present in visit" do
|
2009-09-23 14:46:17 +00:00
|
|
|
webrat_session.should_receive(:get).with("/", {}, {'HTTP_AUTHORIZATION' => "Basic dXNlcjpzZWNyZXQ="})
|
2008-11-23 05:22:49 +00:00
|
|
|
visit("/")
|
2008-10-17 15:43:14 +00:00
|
|
|
end
|
2009-04-08 00:30:12 +00:00
|
|
|
|
2008-10-17 15:43:14 +00:00
|
|
|
it "should be present in form submits" do
|
2008-11-23 05:22:49 +00:00
|
|
|
with_html <<-HTML
|
2008-11-28 05:34:35 +00:00
|
|
|
<html>
|
2008-10-17 15:43:14 +00:00
|
|
|
<form method="post" action="/form1">
|
|
|
|
<input type="submit" />
|
|
|
|
</form>
|
2008-11-28 05:34:35 +00:00
|
|
|
</html>
|
2008-11-23 05:22:49 +00:00
|
|
|
HTML
|
2009-09-23 14:46:17 +00:00
|
|
|
webrat_session.should_receive(:post).with("/form1", {}, {'HTTP_AUTHORIZATION' => "Basic dXNlcjpzZWNyZXQ="})
|
2008-11-23 05:22:49 +00:00
|
|
|
click_button
|
2008-10-17 15:43:14 +00:00
|
|
|
end
|
2009-09-23 14:46:17 +00:00
|
|
|
|
|
|
|
context "with long username and password combination" do
|
|
|
|
before do
|
|
|
|
basic_auth('user', 'secret1234567890123456789012345678901234567890123456789012345678901234567890')
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should be present, without new lines, in visit" do
|
|
|
|
webrat_session.should_receive(:get).with("/", {}, {'HTTP_AUTHORIZATION' => "Basic dXNlcjpzZWNyZXQxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkw"})
|
|
|
|
visit("/")
|
|
|
|
end
|
|
|
|
end
|
2008-10-17 15:43:14 +00:00
|
|
|
end
|