Sha256: 82cfd739bb91468c592df7195c475227344910a134d5332a4dc9bc8108be6e47

Contents?: true

Size: 1.11 KB

Versions: 24

Compression:

Stored size: 1.11 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")

describe "Basic Auth HTTP headers" do
  before do
    basic_auth('user', 'secret')
  end

  it "should be present in visit" do
    webrat_session.should_receive(:get).with("/", {}, {'HTTP_AUTHORIZATION' => "Basic dXNlcjpzZWNyZXQ="})
    visit("/")
  end

  it "should be present in form submits" do
    with_html <<-HTML
      <html>
      <form method="post" action="/form1">
        <input type="submit" />
      </form>
      </html>
    HTML
    webrat_session.should_receive(:post).with("/form1", {}, {'HTTP_AUTHORIZATION' => "Basic dXNlcjpzZWNyZXQ="})
    click_button
  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

Version data entries

24 entries across 24 versions & 12 rubygems

Version Path
radiant-1.0.0 ruby-debug/ruby/1.8/gems/webrat-0.7.3/spec/public/basic_auth_spec.rb
indirect-webrat-0.7.5 spec/public/basic_auth_spec.rb
indirect-webrat-0.7.4 spec/public/basic_auth_spec.rb
webrat-0.7.3 spec/public/basic_auth_spec.rb
jbd-webrat-0.7.2.rails3 spec/public/basic_auth_spec.rb
webrat-0.7.2 spec/public/basic_auth_spec.rb
webrat-0.7.2.beta.2 spec/public/basic_auth_spec.rb
mutle-webrat-0.7.2.beta.1 spec/public/basic_auth_spec.rb
thoughtbot-webrat-0.7.2.pre spec/public/basic_auth_spec.rb
webrat-0.7.2.beta.1 spec/public/basic_auth_spec.rb
honkster-webrat-0.7.1.2 spec/public/basic_auth_spec.rb
honkster-webrat-0.7.1.1 spec/public/basic_auth_spec.rb
revo-webrat-0.7.0.1 spec/public/basic_auth_spec.rb
webrat-0.7.1 spec/public/basic_auth_spec.rb
davidtrogers-webrat-0.7.0 spec/public/basic_auth_spec.rb
revo-webrat-0.7.0 spec/public/basic_auth_spec.rb
revo-webrat-0.7.1.pre spec/public/basic_auth_spec.rb
webrat-0.7.0 spec/public/basic_auth_spec.rb
honkster-webrat-0.6.0.10 spec/public/basic_auth_spec.rb
honkster-webrat-0.6.0.9 spec/public/basic_auth_spec.rb