capybara-typhoeus 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -147,9 +147,8 @@ class Capybara::Driver::Typhoeus < Capybara::Driver::Base
147
147
  :forbid_reuse => true,
148
148
  }
149
149
  opts.merge!({
150
- :username => login,
151
- :password => password,
152
- :auth_method => :basic,
150
+ :userpwd => "#{login}:#{password}",
151
+ :httpauth => :basic,
153
152
  }) if auth?
154
153
  if params.is_a?(Hash)
155
154
  opts[:params] = with_params.merge(params)
@@ -2,14 +2,39 @@ require 'spec_helper'
2
2
 
3
3
  describe Capybara::Driver::Typhoeus do
4
4
  before do
5
- @driver = Capybara::Driver::Typhoeus.new TestApp
5
+ @driver = described_class.new TestApp
6
6
  end
7
-
7
+
8
8
  context "in remote mode" do
9
9
  it_should_behave_like "driver"
10
10
  it_should_behave_like "driver with header support"
11
11
  it_should_behave_like "driver with status code support"
12
12
  # neither supports cookies nor follows redirect automatically
13
13
  end
14
-
15
- end
14
+
15
+ context "basic authentication" do
16
+ subject do
17
+ app = Sinatra.new do
18
+ use Rack::Auth::Basic do |username, password|
19
+ username=="admin" && password=="secret"
20
+ end
21
+ get("/"){ "Success!" }
22
+ end
23
+ described_class.new app
24
+ end
25
+
26
+ it "allow access with right credentials" do
27
+ subject.authenticate_with "admin", "secret"
28
+ subject.get "/"
29
+ subject.status_code.should be 200
30
+ subject.source.should == "Success!"
31
+ end
32
+
33
+ it "deny access with wrong credentials" do
34
+ subject.authenticate_with "admin", "admin"
35
+ subject.get "/"
36
+ subject.status_code.should be 401
37
+ end
38
+ end
39
+
40
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-typhoeus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -152,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
152
  version: '0'
153
153
  segments:
154
154
  - 0
155
- hash: 3275742578761015137
155
+ hash: -3878372464771171920
156
156
  required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  none: false
158
158
  requirements: