commit
3bd7266ab9
|
@ -20,6 +20,7 @@ CHANGED: Due to a reorganization, if you're currently requiring "webrat/rspec-ra
|
||||||
|
|
||||||
* Bug fixes
|
* Bug fixes
|
||||||
|
|
||||||
|
* Remove newlines from HTTP Basic authentication credentials (Michael Klett)
|
||||||
* Require nokogiri form rspec-rails.rb (David Chelimsky)
|
* Require nokogiri form rspec-rails.rb (David Chelimsky)
|
||||||
* Fix logger issue when running inside Cucumber (Damian Janowski)
|
* Fix logger issue when running inside Cucumber (Damian Janowski)
|
||||||
* Fix various issues related to submitting values with HTML entities (Kieran P)
|
* Fix various issues related to submitting values with HTML entities (Kieran P)
|
||||||
|
|
|
@ -105,7 +105,7 @@ For example:
|
||||||
end
|
end
|
||||||
|
|
||||||
def basic_auth(user, pass)
|
def basic_auth(user, pass)
|
||||||
encoded_login = ["#{user}:#{pass}"].pack("m*")
|
encoded_login = ["#{user}:#{pass}"].pack("m*").gsub(/\n/, '')
|
||||||
header('HTTP_AUTHORIZATION', "Basic #{encoded_login}")
|
header('HTTP_AUTHORIZATION', "Basic #{encoded_login}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe "Basic Auth HTTP headers" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should be present in visit" do
|
it "should be present in visit" do
|
||||||
webrat_session.should_receive(:get).with("/", {}, {'HTTP_AUTHORIZATION' => "Basic dXNlcjpzZWNyZXQ=\n"})
|
webrat_session.should_receive(:get).with("/", {}, {'HTTP_AUTHORIZATION' => "Basic dXNlcjpzZWNyZXQ="})
|
||||||
visit("/")
|
visit("/")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -18,7 +18,18 @@ describe "Basic Auth HTTP headers" do
|
||||||
</form>
|
</form>
|
||||||
</html>
|
</html>
|
||||||
HTML
|
HTML
|
||||||
webrat_session.should_receive(:post).with("/form1", {}, {'HTTP_AUTHORIZATION' => "Basic dXNlcjpzZWNyZXQ=\n"})
|
webrat_session.should_receive(:post).with("/form1", {}, {'HTTP_AUTHORIZATION' => "Basic dXNlcjpzZWNyZXQ="})
|
||||||
click_button
|
click_button
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue