catch_and_release 0.0.0 → 0.0.2

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: 95a40f343f7a05c372d164592e586f7e11e22d65
4
- data.tar.gz: ce43684c7ea5068116ad79687780dd093a6a444a
3
+ metadata.gz: efb4dd3fceb906aa83a238321421997500b68020
4
+ data.tar.gz: a19165d432b874007acef707011b368392c53163
5
5
  SHA512:
6
- metadata.gz: 777d2738723980eae67121c9fc387a50d8724aca8a9abfce747970503d71ff3d8134a749aae5d4dbfff39255b354a30567f32d85bc6c4f73397bd17fe6d969de
7
- data.tar.gz: b50e5e40b4041a721d1797e3e6915063ca18940e1e5eb84be2c6f99ceba269e693746b0dd77fdd330c8097240255453867d05a4401c10c6f7a391e58d41c32e6
6
+ metadata.gz: 92c77c670382a69e55ed3ccba6e94ff601764a52b071fb35a958c00a58abb98a8ede9283e6ac0be0ca5e52a561333f45ad9ce3ee2d29e11b662f54f97976aa46
7
+ data.tar.gz: 3e277646acc8e06daa558a335aca601325590f40b92e20dc710662c19d8e496b2e6bcd66e44c68db1b2038830e8f524df4c3028a2964c89dbad9169a6214adcb
@@ -2,6 +2,10 @@ module CatchAndRelease
2
2
  module Catch
3
3
 
4
4
  class << self
5
+ def spec_methods
6
+ [:stdout, :stderr]
7
+ end
8
+
5
9
  def stdout &block
6
10
  Stdout.new.capture(&block).read
7
11
  end
@@ -3,6 +3,10 @@ module CatchAndRelease
3
3
 
4
4
  class << self
5
5
 
6
+ def spec_methods
7
+ [:stdin]
8
+ end
9
+
6
10
  def stdin *args, &block
7
11
  Stdin.new.release(*args, &block)
8
12
  end
@@ -0,0 +1,17 @@
1
+ module CatchAndRelease
2
+ module RSpec
3
+
4
+ Catch.spec_methods.each do |method|
5
+ define_method "catch_#{method}" do |&block|
6
+ Catch.public_send(method,&block)
7
+ end
8
+ end
9
+
10
+ Release.spec_methods.each do |method|
11
+ define_method "release_#{method}" do |*args, &block|
12
+ Release.public_send(method,*args,&block)
13
+ end
14
+ end
15
+
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module CatchAndRelease
2
- VERSION = '0.0.0'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+ require 'catch_and_release/rspec'
3
+
4
+ RSpec.configure do |c|
5
+ c.include CatchAndRelease::RSpec
6
+ end
7
+
8
+ describe CatchAndRelease::RSpec do
9
+ it "includes methods in RSpec scope" do
10
+ expect( respond_to?(:catch_stdout) ).to be_truthy
11
+ end
12
+ it "passes blocks methods" do
13
+ out = catch_stdout do
14
+ print 'hello world'
15
+ end
16
+
17
+ expect( out ).to eq 'hello world'
18
+ end
19
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catch_and_release
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Sloan
@@ -18,10 +18,12 @@ extra_rdoc_files: []
18
18
  files:
19
19
  - lib/catch_and_release/catch.rb
20
20
  - lib/catch_and_release/release.rb
21
+ - lib/catch_and_release/rspec.rb
21
22
  - lib/catch_and_release/version.rb
22
23
  - lib/catch_and_release.rb
23
24
  - spec/lib/catch_and_release/catch_spec.rb
24
25
  - spec/lib/catch_and_release/release_spec.rb
26
+ - spec/lib/catch_and_release/rspec_spec.rb
25
27
  - spec/lib/catch_and_release_spec.rb
26
28
  - spec/spec_helper.rb
27
29
  homepage: http://github.com/stevenosloan/catch_and_release
@@ -51,5 +53,6 @@ summary: Tools for testing standard inputs & outputs
51
53
  test_files:
52
54
  - spec/lib/catch_and_release/catch_spec.rb
53
55
  - spec/lib/catch_and_release/release_spec.rb
56
+ - spec/lib/catch_and_release/rspec_spec.rb
54
57
  - spec/lib/catch_and_release_spec.rb
55
58
  - spec/spec_helper.rb