-
Notifications
You must be signed in to change notification settings - Fork 319
/
puffing_billy.rb
52 lines (44 loc) · 1.76 KB
/
puffing_billy.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Installing Puffing Billy:
# 0. Check spec/support dir is auto-required in spec/rails_helper.rb.
#
# 1. Puffing Billy depends on Capybara. Install Capybara as explained
# in spec/support/capybara.rb
#
# 2. Add puffing-billy to Gemfile:
#
# group :development, :test do
# gem 'puffing-billy'
# end
#
# 3. Create a file like this one you're reading in spec/support/puffing_billy.rb:
require 'billy/rspec'
# 4. Configure cache to behave as required. See all available options at:
# https://github.com/oesmith/puffing-billy#caching
Billy.configure do |c|
c.cache = true
c.cache_request_headers = false
c.persist_cache = true
c.non_successful_cache_disabled = false
c.non_successful_error_level = :warn
# cache_path is where responses from external URLs will be saved as YAML.
c.cache_path = "spec/support/http_cache/billy/"
# Avoid having tests dependent on external URLs.
#
# Only set non_whitelisted_requests_disabled **temporarily**
# to false when first recording a 3rd party interaction. After
# the recording has been stored to cache_path, then set
# non_whitelisted_requests_disabled back to true.
c.non_whitelisted_requests_disabled = true
end
# 5. Uncomment the *_billy driver for your desired browser:
Capybara.javascript_driver = :selenium_billy # Uses Firefox
# Capybara.javascript_driver = :selenium_chrome_billy
# Capybara.javascript_driver = :webkit_billy
# Capybara.javascript_driver = :poltergeist_billy
# 6. Start using Puffing Billy. See spec/features/share_page_spec.rb for an example,
# and find your cached responses in spec/support/http_cache/billy
# Suggested docs
# --------------
# https://github.com/oesmith/puffing-billy
# https://github.com/oesmith/puffing-billy#rspec-usage
# https://github.com/oesmith/puffing-billy#caching