Add VCR support, for more complex mocking.

Daniel O'Connor 10 年之前
父節點
當前提交
46606455c1
共有 3 個文件被更改,包括 13 次插入0 次删除
  1. 2 0
      Gemfile
  2. 2 0
      Gemfile.lock
  3. 9 0
      spec/support/vcr_support.rb

+ 2 - 0
Gemfile

@@ -78,6 +78,8 @@ gem 'therubyracer', '~> 0.12.1'
78 78
 
79 79
 gem 'mqtt'
80 80
 
81
+gem 'vcr'
82
+
81 83
 group :development do
82 84
   gem 'binding_of_caller'
83 85
   gem 'better_errors'

+ 2 - 0
Gemfile.lock

@@ -319,6 +319,7 @@ GEM
319 319
     uuid (2.3.7)
320 320
       macaddr (~> 1.0)
321 321
     uuidtools (2.1.4)
322
+    vcr (2.9.2)
322 323
     warden (1.2.3)
323 324
       rack (>= 1.0)
324 325
     webmock (1.17.4)
@@ -392,6 +393,7 @@ DEPENDENCIES
392 393
   typhoeus (~> 0.6.3)
393 394
   tzinfo-data
394 395
   uglifier (>= 1.3.0)
396
+  vcr
395 397
   webmock
396 398
   weibo_2 (~> 0.1.4)
397 399
   wunderground (~> 1.2.0)

+ 9 - 0
spec/support/vcr_support.rb

@@ -0,0 +1,9 @@
1
+require 'vcr'
2
+
3
+VCR.configure do |c|
4
+  c.cassette_library_dir = 'spec/cassettes'
5
+  c.allow_http_connections_when_no_cassette = true
6
+  c.hook_into :webmock
7
+  c.default_cassette_options = { record: :new_episodes}
8
+  c.configure_rspec_metadata!
9
+end