Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Commit

Permalink
Fixes API key obfuscation for VCR.
Browse files Browse the repository at this point in the history
  • Loading branch information
joegatt committed Jun 12, 2013
1 parent 1ca2343 commit 8da2c82
Show file tree
Hide file tree
Showing 15 changed files with 153 additions and 194 deletions.
8 changes: 4 additions & 4 deletions spec/models/book_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@

describe '#populate!' do
before do
VCR.use_cassette('model/world_cat', decode_compressed_response: true) do
VCR.use_cassette('model/isbndb', decode_compressed_response: true) do
VCR.use_cassette('model/google_books', decode_compressed_response: true) do
VCR.use_cassette('model/open_library', decode_compressed_response: true) do
VCR.use_cassette('model/world_cat') do
VCR.use_cassette('model/isbndb') do
VCR.use_cassette('model/google_books') do
VCR.use_cassette('model/open_library') do
# Secret['auth']['isbndb']['api_key'] = 'OBSCURED'
@book = Book.new
@book.isbn_10 = '0804720991'
Expand Down
4 changes: 2 additions & 2 deletions spec/models/google_books_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

context 'when a book is found' do
before do
VCR.use_cassette('model/google_books', decode_compressed_response: true) do
VCR.use_cassette('model/google_books') do
@google_books_book = GoogleBooks.new('0804720991')
end
end
Expand All @@ -23,7 +23,7 @@

context 'when a book is not found' do
before do
VCR.use_cassette('model/google_books_nil', decode_compressed_response: true) do
VCR.use_cassette('model/google_books_nil') do
@google_books_book_nil = GoogleBooks.new('INVALID_ISBN')
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/models/isbndb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

context 'when a book is found:' do
before do
VCR.use_cassette('model/isbndb', decode_compressed_response: true) do
VCR.use_cassette('model/isbndb') do
# Secret['auth']['isbndb']['api_key'] = 'OBSCURED'
@isbndb_book = Isbndb.new('0804720991')
end
Expand All @@ -25,7 +25,7 @@

context 'when a book is not found:' do
before do
VCR.use_cassette('model/isbndb_nil', decode_compressed_response: true) do
VCR.use_cassette('model/isbndb_nil') do
@isbndb_book_nil = Isbndb.new('INVALID_ISBN')
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/models/open_library_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

context 'when a book is found:' do
before do
VCR.use_cassette('model/open_library', decode_compressed_response: true) do
VCR.use_cassette('model/open_library') do
@open_library_book = OpenLibrary.new('0804720991')
end
end
Expand All @@ -25,7 +25,7 @@

context 'when a book is not found:' do
before do
VCR.use_cassette('model/open_library_nil', decode_compressed_response: true) do
VCR.use_cassette('model/open_library_nil') do
@open_library_book = OpenLibrary.new('INVALID_ISBN')
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/models/world_cat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

context 'when a book is found:' do
before do
VCR.use_cassette('model/world_cat', decode_compressed_response: true) do
VCR.use_cassette('model/world_cat') do
@world_cat_book = WorldCat.new('0804720991')
end
end
Expand All @@ -21,7 +21,7 @@

context 'when a book is not found:' do
before do
VCR.use_cassette('model/world_cat_nil', decode_compressed_response: true) do
VCR.use_cassette('model/world_cat_nil') do
@world_cat_book_nil = WorldCat.new('INVALID_ISBN')
end
end
Expand Down
10 changes: 9 additions & 1 deletion spec/support/vcr_setup.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
VCR.configure do |c|
c.cassette_library_dir = 'spec/vcr_cassettes'
c.hook_into :fakeweb
c.default_cassette_options = { :serialize_with => :syck }
c.default_cassette_options = {
serialize_with: :syck,
decode_compressed_response: true
}
Secret.auth.each do |service_key, service_value|
service_value.each do |param_key, param_value|
c.filter_sensitive_data("<#{ service_key }_#{ param_key }>".upcase) { param_value }
end
end
end
102 changes: 0 additions & 102 deletions spec/vcr_cassettes/model/evernote_note_metadata.yml

This file was deleted.

6 changes: 3 additions & 3 deletions spec/vcr_cassettes/model/google_books.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions spec/vcr_cassettes/model/google_books_nil.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 23 additions & 23 deletions spec/vcr_cassettes/model/isbndb.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions spec/vcr_cassettes/model/isbndb_nil.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8da2c82

Please sign in to comment.