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
|
|
|
|
@session = Webrat::TestSession.new
|
|
|
|
@session.basic_auth('user', 'secret')
|
|
|
|
end
|
|
|
|
|
2008-11-05 23:20:27 +00:00
|
|
|
it "should be present in visit" do
|
2008-10-17 15:43:14 +00:00
|
|
|
@session.should_receive(:get).with("/", {}, {'HTTP_AUTHORIZATION' => "Basic dXNlcjpzZWNyZXQ=\n"})
|
2008-11-05 23:20:27 +00:00
|
|
|
@session.visit("/")
|
2008-10-17 15:43:14 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should be present in form submits" do
|
|
|
|
@session.response_body = <<-EOS
|
|
|
|
<form method="post" action="/form1">
|
|
|
|
<input type="submit" />
|
|
|
|
</form>
|
|
|
|
EOS
|
|
|
|
@session.should_receive(:post).with("/form1", {}, {'HTTP_AUTHORIZATION' => "Basic dXNlcjpzZWNyZXQ=\n"})
|
2008-11-05 23:32:36 +00:00
|
|
|
@session.click_button
|
2008-10-17 15:43:14 +00:00
|
|
|
end
|
|
|
|
end
|