fix keybase spec

This commit is contained in:
Thomas Dziedzic 2020-06-11 17:30:25 -05:00 committed by Peter Bhat Harkins
parent ee42f2f308
commit b32bac90b4
5 changed files with 79 additions and 1 deletions

View File

@ -55,4 +55,6 @@ group :test, :development do
gem "faker"
gem "byebug"
gem "rb-readline"
gem "vcr"
gem "webmock" # used to support vcr
end

View File

@ -70,6 +70,8 @@ GEM
commonmarker (0.21.0)
ruby-enum (~> 0.5)
concurrent-ruby (1.1.6)
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.6)
database_cleaner (1.8.5)
diff-lcs (1.3)
@ -92,6 +94,7 @@ GEM
good_migrations (0.0.2)
activerecord (>= 3.1)
railties (>= 3.1)
hashdiff (1.0.1)
hashery (2.1.2)
htmlentities (4.3.4)
i18n (1.8.2)
@ -212,6 +215,7 @@ GEM
ruby-rc4 (0.1.5)
ruumba (0.1.14)
rubocop
safe_yaml (1.0.5)
scenic (1.5.2)
activerecord (>= 4.0.0)
railties (>= 4.0.0)
@ -241,6 +245,11 @@ GEM
execjs (>= 0.3.0, < 3)
unicode-display_width (1.7.0)
uniform_notifier (1.13.0)
vcr (6.0.0)
webmock (3.8.3)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.7.1)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
@ -289,6 +298,8 @@ DEPENDENCIES
sprockets-rails (= 2.3.3)
transaction_retry
uglifier (>= 1.3.0)
vcr
webmock
BUNDLED WITH
2.1.4

View File

@ -0,0 +1,59 @@
---
http_interactions:
- request:
method: get
uri: https://keybase.io/_/api/1.0/user/pic_url.json?username=cryptojim
body:
encoding: US-ASCII
string: ''
headers:
Host:
- keybase.io
Cookie:
- ''
Referer:
- https://keybase.io/_/api/1.0/user/pic_url.json?username=cryptojim
User-Agent:
- Mozilla/5.0 (compatible)
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
- "*/*"
response:
status:
code: 200
message: OK
headers:
Date:
- Thu, 11 Jun 2020 22:28:50 GMT
Content-Type:
- application/json; charset=utf-8
Content-Length:
- '77'
Connection:
- keep-alive
X-Frame-Options:
- SAMEORIGIN
X-Xss-Protection:
- 1; mode=block
X-Content-Type-Options:
- nosniff
Access-Control-Allow-Origin:
- "*"
Access-Control-Allow-Methods:
- GET
Access-Control-Allow-Headers:
- Content-Type, Authorization, Content-Length, X-Requested-With
Access-Control-Allow-Credentials:
- 'false'
Cache-Control:
- no-store
Etag:
- W/"4d-JswfwKfhQJbTftnpUPSRYMA4ubo"
Strict-Transport-Security:
- max-age=31536000; includeSubdomains; preload
body:
encoding: UTF-8
string: '{"status":{"code":205,"desc":"cryptojim: user not found","name":"NOT_FOUND"}}'
recorded_at: Thu, 11 Jun 2020 22:28:50 GMT
recorded_with: VCR 6.0.0

View File

@ -17,7 +17,9 @@ describe 'keybase proofs', type: :request do
context 'new' do
it 'renders the expected kb_username' do
get '/keybase_proofs/new', params: new_params
VCR.use_cassette('render_expected_kb_username') do
get '/keybase_proofs/new', params: new_params
end
expect(response.body).to include(kb_username)
end
end

4
spec/support/vcr.rb Normal file
View File

@ -0,0 +1,4 @@
VCR.configure do |config|
config.cassette_library_dir = 'fixtures/vcr_cassettes'
config.hook_into :webmock
end