bitcoin_testnet 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -20,6 +20,8 @@ Then, in your `test_helper`/`spec_helper`:
20
20
 
21
21
  Third, tell `BitcoinTestnet` when to do its work:
22
22
 
23
+ **Note**: if you user RSpec and VCR, see "RSpec and VCR" section below.
24
+
23
25
  - Before each spec, call `BitcoinTestnet.start`. This will start and clean the Testnet, so it looks like it did the first time you started the Testnet.
24
26
  - After the test suite is finished, call `BitcoinTestnet.stop`. This turns off the Testnet.
25
27
 
@@ -31,14 +33,9 @@ Sample with RSpec:
31
33
  end
32
34
 
33
35
 
34
- **Tip**: If you'll just use the above, you can configure it automatically by calling `BitcoinTestnet.configure_rspec!`.
35
-
36
- ## TL;DR
37
-
38
- require 'bitcoin_testnet'
36
+ ### RSpec and VCR
39
37
 
40
- BitcoinTestnet.dir = "path/to/testnet"
41
- BitcoinTestnet.configure_rspec!
38
+ Cleaning the Testnet every time is slow. If you have VCR, you can make this a lot faster by calling `BitcoinTestnet.configure_rspec_and_vcr!` in your spec helper. With this, you won't need to call `BitcoinTestnet#start` and `BitcoinTestnet#stop`.
42
39
 
43
40
  ## Installation
44
41
 
@@ -8,6 +8,7 @@ require 'bitcoin_testnet/booter'
8
8
  require 'bitcoin_testnet/stopper'
9
9
 
10
10
  module BitcoinTestnet
11
+
11
12
  mattr_accessor :dir
12
13
  @@dir = nil
13
14
 
@@ -19,10 +20,22 @@ module BitcoinTestnet
19
20
  Stopper.stop
20
21
  end
21
22
 
22
- def self.configure_rspec!
23
+ def self.configure_with_rspec_and_vcr!
23
24
  RSpec.configure do |c|
24
- c.before(:each) { BitcoinTestnet.start }
25
- c.after(:suite) { BitcoinTestnet.stop }
25
+ c.before(:each) do
26
+ if VCR.current_cassette
27
+ cassette_file = VCR.current_cassette.file
28
+ BitcoinTestnet.start unless File.exists?(cassette_file)
29
+ end
30
+ end
31
+
32
+ c.after(:each) do
33
+ if VCR.current_cassette
34
+ cassette_file = VCR.current_cassette.file
35
+ BitcoinTestnet.stop unless File.exists?(cassette_file)
36
+ end
37
+ end
26
38
  end
27
39
  end
40
+
28
41
  end
@@ -14,7 +14,7 @@ module BitcoinTestnet
14
14
  end
15
15
 
16
16
  def exists?
17
- processes.size == 2
17
+ processes.size >= 1
18
18
  end
19
19
 
20
20
  end
@@ -1,3 +1,3 @@
1
1
  module BitcoinTestnet
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitcoin_testnet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-06 00:00:00.000000000 Z
12
+ date: 2013-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport