nist_randomness_beacon 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6336f1cb50b891524b88a874af6c508b3f0c2498
4
- data.tar.gz: 0271cce375a9ac9d60d16ddda2acc087d947c80e
3
+ metadata.gz: 60bec41fd7c12774d5cf87dffad6e2346f365567
4
+ data.tar.gz: 14adb38c42e3007fc97e5a9ab1e096a209a036e1
5
5
  SHA512:
6
- metadata.gz: c1df5e16ed9e97415f3020c1a805ba064fc14d954b93fba04ef209da3332df91a20ee3b6e49e5d4ef44e964b60c9aba7c4aa5b82737070ea8710dc883b2f99df
7
- data.tar.gz: 665862cc39ddf2fa8d1ed24cc41b97bb5eee64ab5c7b08517f97087c5878944a2d23c1a25a0fa25566a997125d2cced13dd70ca8f9ded5651f3985e7021952ed
6
+ metadata.gz: eb10c03c63c4936bcf4bffd10a5ca3efc6f5ba0ca5f0fef5015515c57977113854d4f07a34d853eac2bf8073f3862462cdb13f824a81b76fd97d12d5028ce4c1
7
+ data.tar.gz: 3491fb797c160755f234e415ffeaa57dab229247a3c86cededed16a074a02ecd813bf8f9198f30ec3ccb3773e0a1922ea9599671198074689a3dd1f884d6048a
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
4
+ - 2.1.5
5
+ - 2.0.0
6
+ - 1.9.3
7
+ script: bundle exec rspec spec
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # NIST Randomness Beacon
2
2
 
3
+ [![Build Status](https://travis-ci.org/chaserx/nist_randomness_beacon.svg)](https://travis-ci.org/chaserx/nist_randomness_beacon)
4
+
3
5
  A wrapper for the NIST Randomness Beacon 'cause sometimes you need to get
4
6
  a 512-bit full-entropy bit-string programmatically. You never know.
5
7
 
@@ -1,10 +1,5 @@
1
1
  module NISTRandomnessBeacon
2
2
  # For exceptions encountered with the service
3
3
  class ServiceError < StandardError
4
- attr_reader :body
5
-
6
- def initialize body
7
- @body = body
8
- end
9
4
  end
10
5
  end
@@ -1,3 +1,3 @@
1
1
  module NISTRandomnessBeacon
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://beacon.nist.gov/rest/record/1388552400
5
+ uri: https://beacon.nist.gov/rest/record/1388534400
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -28,11 +28,11 @@ http_interactions:
28
28
  - ARR/2.5
29
29
  - ASP.NET
30
30
  Date:
31
- - Wed, 31 Dec 2014 03:23:22 GMT
31
+ - Wed, 31 Dec 2014 17:35:18 GMT
32
32
  body:
33
33
  encoding: UTF-8
34
34
  string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><record><version>Version
35
- 1.0</version><frequency>60</frequency><timeStamp>1388552400</timeStamp><seedValue>99149759C361F19D3B1BBA4B4F43BA933EBD739C06D8FC84BEF45D1D02BB2B717AD257138141437BF53183CA14D9C2273D6B51CE4269D89200DEA580A6C8FFBF</seedValue><previousOutputValue>19897B9BFCDC32E9D57709EF261C13A770F859CDFDF89665C48C18AD940F1D29C66580F2B488895843F9635BF84475644414747C36A5EFF55867077E01791B27</previousOutputValue><signatureValue>F184E6C6B0F7EEA5183E5A1C828035F956833799A94B1AE38CAD15FE278D7AE77F83B16C0B9C050A2EEDB7AD1EC131204329D70D44005EE937D64711CB98ADCF8A63080E47B8471D11AE01CF31A9A0F61023CFE1BE98F3D04DE62D3F7B08F0D72E122519180B09934B64C987F9C730E8A1340B6C9C240C4814CC51323E7757328D4F8D8D61AAE952F3AA8E7287C814A65BCDD26A0F42F1F9A0E6933964E0A25E689B4688ABCF46EEF10C9591256DD0ACECD45C76732F0273BC61B94573D92A99101D2C2A256B07A02364C879926AF6361D5AC1AAE53986388997BA3AAFE91156164223FE9A300828F94A12966FCB89E08F7A510C99C9F494EFAF9412C1B7BB32</signatureValue><outputValue>26071FBF7858244DD1FF2C4E0C4E1D1EA0FF58A9A35F50A2E62ACED01A9BF0DDE71E0D51DDC488ECD97DB035C5FB23C0D868E4BD45CFDA9F5BF6414DBE31D940</outputValue><statusCode>0</statusCode></record>
35
+ 1.0</version><frequency>60</frequency><timeStamp>1388534400</timeStamp><seedValue>6779AAB4D36251ADD2CBEF5B4E3CB4C6062CEEF2336D241FDDAE74CCE12B01E92DA101D5FA7DEA547CB3985318A0D67643AB865592F3AE46F8EB98B5553767B4</seedValue><previousOutputValue>C0ED0E79055DDE82AF1F81CF7A830774CFB7EA1C1BB996095E0B9CD40D6AC645DE128CD62250360EA9C901C1170F0D993253289BCC93270F62109AB4F443EC92</previousOutputValue><signatureValue>891CFD92B95B00664A5843D33518C47101972A58184376B329BFF17CABF7539DB1E7FAB9115DDFB2A84122DE9B74B6E6994F59313F5499FF20DF56E276A67D735725E919C18263232F64DD6529B4A22515AF14B6D33020F764B0A4ACECD06A8F64A0EF04DDC800E230EA5E756FFFE821638BCF2981CF3276F23F67A11C43668DD167506B55E25D6C57DC2B36AB0FE1E4A255A815F32B45B9972CA632C6639DD1C382687AAA39960528F9EA854791B82D7F55668749F763BB7B02D5145B0D7C20110842811258C3442277CAF44781B580C245D39DB8ACA6E58FD80D0249D9D82145792BD7D7D561AA1BE09EA0F7CFFF193F486C87D56F68FCC37E0D11693C1141</signatureValue><outputValue>AD99BBD71C840D5F2AF85953BD930758F4EB5E6D85EE83209713EDA6D4788B68362B283AACC949ED9E41E0452640F92343D20EBDC6161B1BD7C835FB7CB423CA</outputValue><statusCode>0</statusCode></record>
36
36
  http_version:
37
- recorded_at: Wed, 01 Jan 2014 05:00:00 GMT
37
+ recorded_at: Wed, 01 Jan 2014 00:00:00 GMT
38
38
  recorded_with: VCR 2.9.3
@@ -28,11 +28,11 @@ http_interactions:
28
28
  - ARR/2.5
29
29
  - ASP.NET
30
30
  Date:
31
- - Wed, 31 Dec 2014 03:23:22 GMT
31
+ - Wed, 31 Dec 2014 17:35:18 GMT
32
32
  body:
33
33
  encoding: UTF-8
34
34
  string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><record><version>Version
35
- 1.0</version><frequency>60</frequency><timeStamp>1419996180</timeStamp><seedValue>D841FF661825248DE94C2254AE0BCD9B565A2EA6B93FD3EE01205D59D868B71ABCBFDE5B785A0C7471FC0160CD6A0243FFBEFC884E34EE4DEBD8EC968BF844CA</seedValue><previousOutputValue>1C8DACC558A8C97B8099EFC069CDEDC9BA72F46C2F213A335970F761E440603E1826D1BD0521D738FDBD28B35338DC27FE51CC06FFF3F4C3019C12128390DE20</previousOutputValue><signatureValue>5F11064F6A41FAFA76A99A2F3CA8C2842D7BD49F37C86FFA7FC1EC002EA627CD5049C4EED11B7EB5C4E1CE88C200BC5D6C935A8D39E8AB2B0FC4116BE3C72711975C33765382411A9BEB57BF420D3E885D80C287CF9EF62E3DEE6DAD8998B45DF227B25712B5A374F5253494FB471262472EC668A6E224CEBEB9F7575FF499B231645895BFD2B9F78061DDB15919751F23ED2351954530B6B00247454B29AF92E97B28BC0431D1F17BE963B070B2B2C9BA6AB933F8B2B3495D00F3AAEA38B9075E3BDE8824E6F7164FD58240C02B76C7747A5C2E67DD034ABF18B8446491CC2DAB7B05BAC8F2748973D534D335C5CCB0315F440206958B99C0B1ED04097CC13B</signatureValue><outputValue>8E7ECAE502E68A90F9C3284460B43383685FDED5C021F761CED640968C479F4238FDBA17D07C94B4520F6440384913DAE0DD2DAEF03A9988CE295473773B939B</outputValue><statusCode>0</statusCode></record>
35
+ 1.0</version><frequency>60</frequency><timeStamp>1420047300</timeStamp><seedValue>134CC13A1919C6A4D5B5D59FCFE232E9341E02F1AFBC983EF8AB71B1ED1BC9A8DC236F2AB674D996572AEFD3D35C4935D99458AC505FFAA62975BB7893E3084D</seedValue><previousOutputValue>F5EEB6D7A32B96C65B54D0330184CAE5E766B5C536DBA52F4C772A0251CDD1E1B6A8F5EBABAD088A542128B4D6E7F19C7213AC2ABFFE9A215EDABAD10FDCAE0B</previousOutputValue><signatureValue>566686E928DA02502347A404EB229D2E519B5CE8BF659C2DD2EC410C235DD207112F35E47DBA3BF86A44F29BA1A225FB1684D671BFC23D5E258942381E84C7D56FFF1B635500E5FE5ACFFF88890CB6045D372D48A7F8DF06EBEA7E2545C92D616EB689A856F32503E578A80D6691E17938BF179C3184E369DC6C3C6346DCB6FF814F7B530232CC2BFE3A3C1CC58D475826B29A4A83079A4A5C9D251171960B4FEFFE85532BD5D1D8DE00905BA987B072C8F3107CFE31B5EB3395FAC8E5E23A2037DD21D5CEA68756C872DF62CE73222DABC8205FAAAEFE414AEBE017F277D938669C1AFC5756CB1674FDBF4761C81173A1FDD856E0FEB531829FBAE6A27C4D16</signatureValue><outputValue>7C8704B82E9A0F9D210DF1B20C6B76330B686DEC06B50BCCC279B793810938C19525F699E6B2F74C3CC5DB96A605C4C0795F7EAC342001F417877126AE779943</outputValue><statusCode>0</statusCode></record>
36
36
  http_version:
37
- recorded_at: Wed, 01 Jan 2014 05:00:00 GMT
37
+ recorded_at: Wed, 01 Jan 2014 00:00:00 GMT
38
38
  recorded_with: VCR 2.9.3
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://beacon.nist.gov/rest/record/next/1388552400
5
+ uri: https://beacon.nist.gov/rest/record/next/1388534400
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -28,11 +28,11 @@ http_interactions:
28
28
  - ARR/2.5
29
29
  - ASP.NET
30
30
  Date:
31
- - Wed, 31 Dec 2014 03:23:24 GMT
31
+ - Wed, 31 Dec 2014 17:35:17 GMT
32
32
  body:
33
33
  encoding: UTF-8
34
34
  string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><record><version>Version
35
- 1.0</version><frequency>60</frequency><timeStamp>1388552460</timeStamp><seedValue>78646721C71A528C5F6E597B955094722A75BCFBD3C8C4B330F2BCE7C42911BE4A2C99B0EA8DCE6133ACEE26E6E26171ACB6C7D541CB68820EF22FCE5983F6BF</seedValue><previousOutputValue>26071FBF7858244DD1FF2C4E0C4E1D1EA0FF58A9A35F50A2E62ACED01A9BF0DDE71E0D51DDC488ECD97DB035C5FB23C0D868E4BD45CFDA9F5BF6414DBE31D940</previousOutputValue><signatureValue>DF7E200927197AD10C1DB7987142D818F9B2F701DA1C8AC35393B3C6B3DE2B3FB8A473BB3F7010BC942F084D7D9BD16C05746831ACF0076238FB540A70B51E7BA5AFD1D959B465A7EBBE179E6C7BE01F2BCBFF6E74FD0997CEBCCB49E9EEDAE8662D9716BEDF5775AE1678193A434C8145B53A003118F18AFFB45A464115888AC9F67CFC0D47DB696C81C4438AE154405E9F9F86B2A4FAB621F272B8962D37358960AE8C1A850232BDFFA9D57873619CDD5F1A1D97EFA19A293F189CD236CB4700CE4B9C5823DDFA20F984108F0CB24F8A47743C27E54446183EFBABECA1740A3383D3BC806DD0EC06DA302710D04A89910E12840C54DC13D24E8BFA9762A51A</signatureValue><outputValue>542B7881E44FCB88E04831285C9C0EEF4DCB087A9C296AF3FEE42C1613E5229E742B24C3F3A8A3C6A06DE30EB115BE78541357D6EAD26240EC30F70000A2F0EE</outputValue><statusCode>0</statusCode></record>
35
+ 1.0</version><frequency>60</frequency><timeStamp>1388534460</timeStamp><seedValue>18F9020613775ADBAE42380DC6C5B4D14B271ACD127072DD8F6B186043BF12B96E9340A7A43E1EB83A20ED6F1EF3FCEF08A0F6314368D5E578C80AC34CC0D4A8</seedValue><previousOutputValue>AD99BBD71C840D5F2AF85953BD930758F4EB5E6D85EE83209713EDA6D4788B68362B283AACC949ED9E41E0452640F92343D20EBDC6161B1BD7C835FB7CB423CA</previousOutputValue><signatureValue>EB23375728297EC81D3D37C8BCF5BB1590ED9EC4F7A7508FC7141488137A8544D780109224C5595166723AFFD092EF02D89C4AF16F891797338AF1FAB11C37ADE474D8E056646ECADFB1EE54DCCA4941A1D8CE81F40953F835C4DB82E081CBEBCEDACDF33F20A9364A3D4EA11B7230378A8AEBF07CDC232A628DD98685EA6652C3BC82A63602C09C0EEFADEE8D282ADBF20A1717895FAEC06A567C494916FFFFBCE192D0FBEFEBBFAFA8BA7FD7DEB1986042860025CE9DC472352F9B6571A7D87AB12DCB418056C691AF91AE65DF4B825F4C169547E713EE49E2346145880D21E213B030114B1670C8A6B4CDC6830A1196DEF5A92C6251912ECEB4290F4FF887</signatureValue><outputValue>D75C4DDA773D9E3CA2A25EACF891B4162369FE9745A4FB87F11D622F8878533BEAA34A6BAB308AF0954A4808A67C6ABBA20B20CA5EA8591753340200F9BAB2F2</outputValue><statusCode>0</statusCode></record>
36
36
  http_version:
37
- recorded_at: Wed, 01 Jan 2014 05:00:00 GMT
37
+ recorded_at: Wed, 01 Jan 2014 00:00:00 GMT
38
38
  recorded_with: VCR 2.9.3
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://beacon.nist.gov/rest/record/previous/1388552400
5
+ uri: https://beacon.nist.gov/rest/record/previous/1388534400
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -28,11 +28,11 @@ http_interactions:
28
28
  - ARR/2.5
29
29
  - ASP.NET
30
30
  Date:
31
- - Wed, 31 Dec 2014 03:23:24 GMT
31
+ - Wed, 31 Dec 2014 17:35:17 GMT
32
32
  body:
33
33
  encoding: UTF-8
34
34
  string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><record><version>Version
35
- 1.0</version><frequency>60</frequency><timeStamp>1388552340</timeStamp><seedValue>D2447EAB04865C191D2969BE50909E8E4E2E83763745D2DD53159BA1D51CDEBF8B764561D619AA807FAFBDE330B047AD987BBBA19B2253A04AD5EC61D863E220</seedValue><previousOutputValue>B22A55266D370DA102733D5EA7D4B4325D5FB57AD49EF7D439543F5CCB46828B1541AD2E563E7C7E6564CDA17F9CDC7542D38453C6F7F5A6122AF39CEC7F5AD2</previousOutputValue><signatureValue>FB3722B4F8752ABFDAA1FCB071918619D7620EE7F4FD9F28CBDB5A7BABB5CBD054CAF7D62C2FA103BEAF381C94108A752E3917F6B5EFBEC964577F30F694D9045BFE8E4A25D424EEFBC28959C80512EBABE038C46EBEC77C22FAD7F94D9681CDB989DECA9EB50314B43CCD549A5C6BFB6C2C69567AC0946531936F60835DB4210ED4546A672C848467FB85375883CBF06C4286878D05062A32AE74C3C17C721890D78BEE14FFC6942441A3CD20BEC277FADF83537F8C56EAD7F075114D6FE29E98C11417945BDB1F80FC7107F6EED14786193782732B6EB3C048A46E5F53ABFC3EBB6539772B7B3133E86F13DEDB96B4E7033618B356E3620408739E0861E420</signatureValue><outputValue>19897B9BFCDC32E9D57709EF261C13A770F859CDFDF89665C48C18AD940F1D29C66580F2B488895843F9635BF84475644414747C36A5EFF55867077E01791B27</outputValue><statusCode>0</statusCode></record>
35
+ 1.0</version><frequency>60</frequency><timeStamp>1388534340</timeStamp><seedValue>C06703BB1C9779ECD26C439F415FE0AA8957A1BCF47E0B4F54F9FD422B68FB8DF3A804CE93F8B7650B42A7D364A7A14DE3F682EB38E5E27CB83C17681135D9C7</seedValue><previousOutputValue>94C1596B5B04B4891A77FE45886500094D04DBF7F329B0004EC75B3EC34B50B475D303F0CF05EDA210091A0727E1B5972D0A62C479F5CD32ADDF93FD6CA513D8</previousOutputValue><signatureValue>5766247F2ADEB64853362233A41678448EFE32DF918E6F61FE27B21A62C8713E97B745F536BFD241A98A398D2854E968142240C006163BF5CF59F9E5ACBBC61D99AA6E84E647E32243EFA69DBE8A7699724687F516A60E30400C07E28B344B39D51A8F15A0DEB5AE187DE86DE3BFE2AD959A74C35DA5AD966D5B5932F4A78782F3C30244EE0870DD2BA9CFD0D47541EB8CE1E145CD7C26AD662825EAA0F3DE565545A44AE8572A5FB8FE43B0B43D6F13DF0066BCBD09195AC94EB48DB2D719946EB83D3255EFFEC22DB22D42070DED5C9B5FAE38C6C348AB44C33574CDFE342FD67DD69C815892DD396E0BDE882C4312D0DDBC26EFB0A475AF00CA3F55600A05</signatureValue><outputValue>C0ED0E79055DDE82AF1F81CF7A830774CFB7EA1C1BB996095E0B9CD40D6AC645DE128CD62250360EA9C901C1170F0D993253289BCC93270F62109AB4F443EC92</outputValue><statusCode>0</statusCode></record>
36
36
  http_version:
37
- recorded_at: Wed, 01 Jan 2014 05:00:00 GMT
37
+ recorded_at: Wed, 01 Jan 2014 00:00:00 GMT
38
38
  recorded_with: VCR 2.9.3
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://beacon.nist.gov/rest/record/start-chain/1388552400
5
+ uri: https://beacon.nist.gov/rest/record/start-chain/1388534400
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -28,11 +28,11 @@ http_interactions:
28
28
  - ARR/2.5
29
29
  - ASP.NET
30
30
  Date:
31
- - Wed, 31 Dec 2014 03:24:53 GMT
31
+ - Wed, 31 Dec 2014 17:35:19 GMT
32
32
  body:
33
33
  encoding: UTF-8
34
34
  string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><record><version>Version
35
35
  1.0</version><frequency>60</frequency><timeStamp>1378395540</timeStamp><seedValue>87F49DB997D2EED0B4FDD93BAA4CDFCA49095AF98E54B81F2C39B5C4002EC04B8C9E31FA537E64AC35FA2F038AA80730B054CFCF371AB5584CFB4EFD293280EE</seedValue><previousOutputValue>00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</previousOutputValue><signatureValue>F93BBE5714944F31983AE8187D5D94F87FFEC2F98185F9EB4FE5DB61A9E5119FB0756E9AF4B7112DEBF541E9E53D05346B7358C12FA43A8E0D695BFFAF193B1C3FFC4AE7BCF6651812B6D60190DB8FF23C9364374737F45F1A89F22E1E492B0F373E4DB523274E9D31C86987C64A26F507008828A358B0E166A197D433597480895E9298C60D079673879C3C1AEDA6306C3201991D0A6778B21462BDEBB8D3776CD3D0FA0325AFE99B2D88A7C357E62170320EFB51F9749B5C7B9E7347178AB051BDD097B226664A2D64AF1557BB31540601849F0BE3AAF31D7A25E2B358EEF5A346937ADE34A110722DA8C037F973350B3846DCAB16C9AA125F2027C246FDB3</signatureValue><outputValue>17070B49DBF3BA12BEA427CB6651ECF7860FDC3792268031B77711D63A8610F4CDA551B7FB331103889A62E2CB23C0F85362BBA49B9E0086D1DA0830E4389AB1</outputValue><statusCode>1</statusCode></record>
36
36
  http_version:
37
- recorded_at: Wed, 01 Jan 2014 05:00:00 GMT
37
+ recorded_at: Wed, 01 Jan 2014 00:00:00 GMT
38
38
  recorded_with: VCR 2.9.3
data/spec/client_spec.rb CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
 
4
4
  describe NISTRandomnessBeacon::Client do
5
5
  before do
6
- Timecop.freeze(Time.local(2014))
6
+ Timecop.freeze(Time.utc(2014))
7
7
  end
8
8
 
9
9
  after do
@@ -11,62 +11,127 @@ describe NISTRandomnessBeacon::Client do
11
11
  end
12
12
 
13
13
  describe 'current' do
14
- subject {
15
- VCR.use_cassette('current') do
16
- NISTRandomnessBeacon::Client.new.current
14
+ context 'successful response' do
15
+ subject {
16
+ VCR.use_cassette('current') do
17
+ NISTRandomnessBeacon::Client.new.current
18
+ end
19
+ }
20
+
21
+ it 'returns a record object' do
22
+ expect(subject).to be_an_instance_of(NISTRandomnessBeacon::Record)
17
23
  end
18
- }
24
+ end
25
+
26
+ context 'problematic response' do
27
+ subject {
28
+ NISTRandomnessBeacon::Client.new.current
29
+ }
19
30
 
20
- it 'returns a record object' do
21
- expect(subject).to be_an_instance_of(NISTRandomnessBeacon::Record)
31
+ it 'raises service error' do
32
+ stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500)
33
+ expect{subject}.to raise_error
34
+ end
22
35
  end
23
36
  end
24
37
 
25
38
  describe 'previous' do
26
- subject {
27
- VCR.use_cassette('previous') do
28
- NISTRandomnessBeacon::Client.new.previous
39
+ context 'successful response' do
40
+ subject {
41
+ VCR.use_cassette('previous') do
42
+ NISTRandomnessBeacon::Client.new.previous
43
+ end
44
+ }
45
+
46
+ it 'returns a record object' do
47
+ expect(subject).to be_an_instance_of(NISTRandomnessBeacon::Record)
29
48
  end
30
- }
49
+ end
50
+
51
+ context 'problematic response' do
52
+ subject {
53
+ NISTRandomnessBeacon::Client.new.previous
54
+ }
31
55
 
32
- it 'returns a record object' do
33
- expect(subject).to be_an_instance_of(NISTRandomnessBeacon::Record)
56
+ it 'raises service error' do
57
+ stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500)
58
+ expect{subject}.to raise_error
59
+ end
34
60
  end
35
61
  end
36
62
 
37
63
  describe 'next' do
38
- subject {
39
- VCR.use_cassette('next') do
40
- NISTRandomnessBeacon::Client.new.next
64
+ context 'successful response' do
65
+ subject {
66
+ VCR.use_cassette('next') do
67
+ NISTRandomnessBeacon::Client.new.next
68
+ end
69
+ }
70
+
71
+ it 'returns a record object' do
72
+ expect(subject).to be_an_instance_of(NISTRandomnessBeacon::Record)
41
73
  end
42
- }
74
+ end
43
75
 
44
- it 'returns a record object' do
45
- expect(subject).to be_an_instance_of(NISTRandomnessBeacon::Record)
76
+ context 'problematic response' do
77
+ subject {
78
+ NISTRandomnessBeacon::Client.new.next
79
+ }
80
+
81
+ it 'raises service error' do
82
+ stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500)
83
+ expect{subject}.to raise_error
84
+ end
46
85
  end
47
86
  end
48
87
 
49
88
  describe 'last' do
50
- subject {
51
- VCR.use_cassette('last') do
52
- NISTRandomnessBeacon::Client.new.last
89
+ context 'successful response' do
90
+ subject {
91
+ VCR.use_cassette('last') do
92
+ NISTRandomnessBeacon::Client.new.last
93
+ end
94
+ }
95
+
96
+ it 'returns a record object' do
97
+ expect(subject).to be_an_instance_of(NISTRandomnessBeacon::Record)
53
98
  end
54
- }
99
+ end
100
+
101
+ context 'problematic response' do
102
+ subject {
103
+ NISTRandomnessBeacon::Client.new.current
104
+ }
55
105
 
56
- it 'returns a record object' do
57
- expect(subject).to be_an_instance_of(NISTRandomnessBeacon::Record)
106
+ it 'raises service error' do
107
+ stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500)
108
+ expect{subject}.to raise_error
109
+ end
58
110
  end
59
111
  end
60
112
 
61
113
  describe 'start chain' do
62
- subject {
63
- VCR.use_cassette('start_chain') do
64
- NISTRandomnessBeacon::Client.new.start_chain
114
+ context 'successful response' do
115
+ subject {
116
+ VCR.use_cassette('start_chain') do
117
+ NISTRandomnessBeacon::Client.new.start_chain
118
+ end
119
+ }
120
+
121
+ it 'returns a record object' do
122
+ expect(subject).to be_an_instance_of(NISTRandomnessBeacon::Record)
65
123
  end
66
- }
124
+ end
67
125
 
68
- it 'returns a record object' do
69
- expect(subject).to be_an_instance_of(NISTRandomnessBeacon::Record)
126
+ context 'problematic response' do
127
+ subject {
128
+ NISTRandomnessBeacon::Client.new.start_chain
129
+ }
130
+
131
+ it 'raises service error' do
132
+ stub_request(:get, /.*beacon.nist.gov*./).to_return(status: 500)
133
+ expect{subject}.to raise_error
134
+ end
70
135
  end
71
136
  end
72
137
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nist_randomness_beacon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chase Southard
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-31 00:00:00.000000000 Z
12
+ date: 2015-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -176,6 +176,7 @@ extra_rdoc_files: []
176
176
  files:
177
177
  - ".gitignore"
178
178
  - ".rspec"
179
+ - ".travis.yml"
179
180
  - CONTRIBUTING.md
180
181
  - Gemfile
181
182
  - LICENSE.txt