bitbank 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +23 -0
- data/.document +5 -0
- data/.rspec +2 -0
- data/Gemfile +23 -0
- data/Gemfile.lock +59 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +60 -0
- data/Rakefile +42 -0
- data/VERSION +1 -0
- data/bitbank.gemspec +112 -0
- data/config.yml +4 -0
- data/lib/bitbank.rb +47 -0
- data/lib/bitbank/account.rb +36 -0
- data/lib/bitbank/client.rb +58 -0
- data/lib/bitbank/transaction.rb +43 -0
- data/spec/account_spec.rb +64 -0
- data/spec/bitbank_spec.rb +37 -0
- data/spec/client_spec.rb +134 -0
- data/spec/fixtures/vcr_cassettes/account/address.yml +30 -0
- data/spec/fixtures/vcr_cassettes/account/balance.yml +30 -0
- data/spec/fixtures/vcr_cassettes/account/new_address.yml +30 -0
- data/spec/fixtures/vcr_cassettes/account/pay.yml +60 -0
- data/spec/fixtures/vcr_cassettes/account/transactions.yml +30 -0
- data/spec/fixtures/vcr_cassettes/client/accounts.yml +30 -0
- data/spec/fixtures/vcr_cassettes/client/balance.yml +30 -0
- data/spec/fixtures/vcr_cassettes/client/balance_account.yml +30 -0
- data/spec/fixtures/vcr_cassettes/client/block_count.yml +30 -0
- data/spec/fixtures/vcr_cassettes/client/difficulty.yml +30 -0
- data/spec/fixtures/vcr_cassettes/client/get_work.yml +30 -0
- data/spec/fixtures/vcr_cassettes/client/info.yml +30 -0
- data/spec/fixtures/vcr_cassettes/client/new_address.yml +30 -0
- data/spec/fixtures/vcr_cassettes/client/transactions.yml +30 -0
- data/spec/fixtures/vcr_cassettes/client/transactions_account.yml +30 -0
- data/spec/fixtures/vcr_cassettes/transaction/details.yml +30 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/support/focused.rb +7 -0
- data/spec/transaction_spec.rb +73 -0
- metadata +232 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"listtransactions","params":["adent"]}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '63'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Mon, 13 Jun 2011 01:29:29 +0000
|
21
|
+
content-length:
|
22
|
+
- '42'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":[{"account":"adent","address":"addr1","category":"receive","amount":0.02000000,"confirmations":4591,"txid":"txid1","time":1306082334}],"error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"listaccounts"}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '40'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Sun, 12 Jun 2011 03:05:26 +0000
|
21
|
+
content-length:
|
22
|
+
- '85'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":{"":0.00,"prefect":10.05,"misc":5.00},"error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"getbalance"}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '38'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Sun, 12 Jun 2011 02:50:44 +0000
|
21
|
+
content-length:
|
22
|
+
- '50'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":12.34000000,"error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"getbalance","params":["prefect"]}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '54'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Sun, 12 Jun 2011 03:36:43 +0000
|
21
|
+
content-length:
|
22
|
+
- '50'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":10.05,"error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"getblockcount"}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '41'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Sun, 12 Jun 2011 21:14:42 +0000
|
21
|
+
content-length:
|
22
|
+
- '46'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":130361,"error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"getdifficulty"}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '41'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Sun, 12 Jun 2011 04:27:55 +0000
|
21
|
+
content-length:
|
22
|
+
- '55'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":567358.22457067,"error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"getwork"}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '35'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Sun, 12 Jun 2011 21:39:27 +0000
|
21
|
+
content-length:
|
22
|
+
- '600'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":{"midstate":"ace5f7dd75ea5372e40894388064b5be6e78e616bcb0f820fb05cdf730999d4c","data":"00000001c71b0f4c49d00e869ecad1faa0d4bfb758d33d9cc65de51300001c1a000000006546598cf54417fc415bd2c14f452b457423b87f81f33cbc1fc9effb497e69ca4df5320b1a1d932f00000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000","hash1":"00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000","target":"00000000000000000000000000000000000000000000002f931d000000000000"},"error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"getinfo"}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '35'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Sun, 12 Jun 2011 04:27:56 +0000
|
21
|
+
content-length:
|
22
|
+
- '279'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":{"version":32100,"balance":0.01000000,"blocks":130202,"connections":5,"proxy":"","generate":false,"genproclimit":-1,"difficulty":567358.22457067,"hashespersec":0,"testnet":false,"keypoololdest":1305908828,"paytxfee":0.00000000,"errors":""},"error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"getnewaddress"}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '41'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Mon, 13 Jun 2011 04:36:13 +0000
|
21
|
+
content-length:
|
22
|
+
- '76'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":"1EzxbYD4rFvZBjUEbtnKZ9KJdrqHB7mkZE","error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"listtransactions","params":[]}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '56'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Mon, 13 Jun 2011 00:28:03 +0000
|
21
|
+
content-length:
|
22
|
+
- '1197'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":[{"account":"adent","address":"addr1","category":"receive","amount":0.02000000,"confirmations":4591,"txid":"txid1","time":1306082334},{"account":"prefect","address":"addr2","category":"receive","amount":0.02000000,"confirmations":4590,"txid":"txid2","time":1306082627},{"account":"prefect","address":"addr3","category":"receive","amount":1.00000000,"confirmations":1992,"txid":"txid3","time":1307126515},{"account":"prefect","address":"addr4","category":"send","amount":-1.00000000,"fee":-0.01000000,"confirmations":1951,"txid":"txid4","time":1307144775}],"error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"listtransactions","params":["adent"]}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '63'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Mon, 13 Jun 2011 01:29:29 +0000
|
21
|
+
content-length:
|
22
|
+
- '42'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":[{"account":"adent","address":"addr1","category":"receive","amount":0.02000000,"confirmations":4591,"txid":"txid1","time":1306082334}],"error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://testuser:testpass@localhost:8332/
|
6
|
+
body: ! '{"id":"jsonrpc","method":"gettransaction","params":["txid1"]}'
|
7
|
+
headers:
|
8
|
+
accept:
|
9
|
+
- ! '*/*; q=0.5, application/xml'
|
10
|
+
accept-encoding:
|
11
|
+
- gzip, deflate
|
12
|
+
content-length:
|
13
|
+
- '120'
|
14
|
+
response: !ruby/struct:VCR::Response
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
date:
|
20
|
+
- Mon, 13 Jun 2011 02:51:12 +0000
|
21
|
+
content-length:
|
22
|
+
- '289'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
server:
|
26
|
+
- bitcoin-json-rpc/0.3.21-beta
|
27
|
+
body: ! '{"result":{"amount":1.00000000,"confirmations":2009,"txid":"txid1","time":1307126515,"details":[{"account":"prefect","address":"addr1","category":"receive","amount":1.00000000}]},"error":null,"id":"jsonrpc"}
|
28
|
+
|
29
|
+
'
|
30
|
+
http_version: '1.1'
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'mocha'
|
5
|
+
require 'vcr'
|
6
|
+
|
7
|
+
require 'bitbank'
|
8
|
+
|
9
|
+
# Requires supporting files with custom matchers and macros, etc,
|
10
|
+
# in ./support/ and its subdirectories.
|
11
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.mock_with :mocha
|
15
|
+
config.extend VCR::RSpec::Macros
|
16
|
+
end
|
17
|
+
|
18
|
+
VCR.config do |c|
|
19
|
+
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
20
|
+
c.stub_with :webmock
|
21
|
+
c.default_cassette_options = { :record => :none }
|
22
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
# Configure RSpec to run focused specs, and also respect the alias 'fit' for focused specs
|
3
|
+
config.filter_run :focused => true
|
4
|
+
config.alias_example_to :fit, :focused => true
|
5
|
+
config.alias_example_to :pit, :pending => true
|
6
|
+
config.run_all_when_everything_filtered = true
|
7
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Bitbank::Transaction" do
|
4
|
+
before(:each) do
|
5
|
+
@client = Bitbank.new(File.join(File.dirname(__FILE__), '..', 'config.yml'))
|
6
|
+
@transaction = Bitbank::Transaction.new(@client, 'txid1',
|
7
|
+
:account => 'adent', :address => 'addr1',
|
8
|
+
:category => 'receive', :amount => 0.02,
|
9
|
+
:confirmations => 1001, :time => 1306082334)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should have a transaction id' do
|
13
|
+
@transaction.txid.should == 'txid1'
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'loaded without details' do
|
17
|
+
use_vcr_cassette 'transaction/details'
|
18
|
+
|
19
|
+
it 'should force-load extra attributes' do
|
20
|
+
@transaction = Bitbank::Transaction.new(@client, 'txid1')
|
21
|
+
@transaction.address.should == 'addr1'
|
22
|
+
@transaction.amount.should == 1.00
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should have an account' do
|
27
|
+
account = @transaction.account
|
28
|
+
account.is_a?(Bitbank::Account).should be_true
|
29
|
+
account.name.should == 'adent'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should have an address' do
|
33
|
+
@transaction.address.should == 'addr1'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should have a category' do
|
37
|
+
@transaction.category.should == 'receive'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should have an amount' do
|
41
|
+
@transaction.amount.should == 0.02
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should have a time' do
|
45
|
+
@transaction.time.strftime("%m-%d-%y").should == "05-22-11"
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should be a confirmed transaction' do
|
49
|
+
@transaction.should be_confirmed
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'confirmations' do
|
53
|
+
it 'should have confirmations' do
|
54
|
+
@transaction.confirmations.should == 1001
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should have enough to be confirmed' do
|
58
|
+
@transaction.should be_confirmed
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should not have enough to be confirmed' do
|
62
|
+
Bitbank::Transaction.new(@client, 'txid2', :confirmations => 5).should_not be_confirmed
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe 'equality' do
|
67
|
+
it 'should compare transaction ids' do
|
68
|
+
Bitbank::Transaction.any_instance.stubs(:load_details)
|
69
|
+
@transaction.should_not == Bitbank::Transaction.new(@client, 'txid2')
|
70
|
+
@transaction.should == Bitbank::Transaction.new(@client, 'txid1')
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|