capybara-typhoeus 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ class Capybara::Driver::Typhoeus < Capybara::Driver::Base
7
7
  end
8
8
  end
9
9
 
10
- attr_accessor :as, :follow
10
+ attr_writer :as, :with_headers, :with_params
11
11
  attr_reader :app, :rack_server, :options, :response
12
12
 
13
13
  def client
@@ -114,22 +114,31 @@ class Capybara::Driver::Typhoeus < Capybara::Driver::Base
114
114
  reset_cache
115
115
  end
116
116
 
117
+ def reset_with!
118
+ @with_headers = {}
119
+ @with_params = {}
120
+ end
121
+
117
122
  def as
118
123
  @as ||= "application/json"
119
124
  end
120
125
 
121
- def with
122
- @with ||= {}
126
+ def with_headers
127
+ @with_headers ||= {}
128
+ end
129
+
130
+ def with_params
131
+ @with_params ||= {}
123
132
  end
124
133
 
125
134
  def process(method, path, params = {}, headers = {})
126
135
  @current_uri = url path
127
136
  opts = {
128
137
  :method => method,
129
- :headers => headers.merge("Content-Type" => as, "Accept" => as),
138
+ :headers => with_headers.merge(headers.merge("Content-Type" => as, "Accept" => as)),
130
139
  :timeout => 2000, # 2 seconds
131
140
  }
132
- opts[method==:get ? :params : :body] = params
141
+ opts[method==:get ? :params : :body] = with_params.merge(params)
133
142
  request = Typhoeus::Request.new @current_uri, opts
134
143
  client.queue request
135
144
  client.run
@@ -2,4 +2,5 @@ require 'capybara/typhoeus'
2
2
 
3
3
  Before('@typhoeus') do
4
4
  Capybara.current_driver = :typhoeus
5
+ page.driver.reset_with!
5
6
  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.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: capybara
17
- requirement: &2156083520 !ruby/object:Gem::Requirement
17
+ requirement: &2158140240 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.4.1
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2156083520
25
+ version_requirements: *2158140240
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: typhoeus
28
- requirement: &2156082760 !ruby/object:Gem::Requirement
28
+ requirement: &2158139760 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 0.2.4
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2156082760
36
+ version_requirements: *2158139760
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: yajl-ruby
39
- requirement: &2156082100 !ruby/object:Gem::Requirement
39
+ requirement: &2158139280 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: 0.8.2
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2156082100
47
+ version_requirements: *2158139280
48
48
  description: Typhoeus driver for Capybara, allowing testing of REST APIs
49
49
  email: joseph.halter@thetalentbox.com
50
50
  executables: []