fakeout 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,46 +1,55 @@
1
1
  h1. Fakeout
2
2
 
3
- Fakeout helps you test your command line libraries. It captures all output to @STDOUT@ and @STDERR@ during test execution so you can ensure your library is yelling the right things at the user.
3
+ Fakeout is an easy way of testing the output of your command line tools and libraries.
4
4
 
5
- h2. Install
5
+ It catches all output to @$stdout@ and @$stderr@ while activated so you can test the correct output is given by your library or script. It also has the nice side-effect of keeping your test results from being crapped up with non test result text and data.
6
6
 
7
- gem install fakeout
7
+ h2. Usage
8
8
 
9
- h2. RSpec
9
+ To load and activate Fakeout:
10
10
 
11
- h3. Activate (before) and Deactivate (after) In All Specs
11
+ bc.. require "fakeout"
12
12
 
13
- bc.. require "fakeout/spec_helpers"
13
+ h3. Manually Activate and Deactivate
14
14
 
15
- RSpec.config do |c|
16
- c.include Fakeout::SpecHelpers
17
- end
15
+ If you want to control when Fakeout starts and stops capturing output:
18
16
 
19
- h3. Only Certain Specs
17
+ bc.. require "fakeout/safe"
20
18
 
21
- bc.. require "fakeout/spec_helpers"
19
+ Fakeout.activate!
20
+ # your code
21
+ Fakeout.deactivate!
22
22
 
23
- describe "Something" do
24
- include Fakeout::SpecHelpers
23
+ p. Both of the approaches above work for RSpec, UnitTest, or whatever.
24
+
25
+ h2. Helpers
26
+
27
+ Including the @Fakeout::TestHelpers@ module into your spec or test class exposes two objects, @stdout@ and @stderr@, each containing any output sent, while Fakeout is activated, to @$stdout@ and @$stderr@, respectively.
28
+
29
+ bc.. it "should rawr to $stdout" do
30
+ lion.rawr_to_stdout
31
+ stdout.should include "RAWR!!"
25
32
  end
26
33
 
27
- h3. Manually Activate and Deactivate
34
+ h2. RSpec
28
35
 
29
- bc.. require "fakeout/spec_helpers"
36
+ @Fakeout::SpecHelpers@ will automatically activate before each example and deactivate after each one when included. It can be included into individual Example Groups:
30
37
 
31
- describe "Something" do
38
+ bc.. describe "Something" do
32
39
  include Fakeout::SpecHelpers
40
+ end
41
+
42
+ p. or included into all Example Groups:
33
43
 
34
- before { Fakeout.activate! }
35
- after { Fakeout.deactivate! }
44
+ bc.. RSpec.config do |c|
45
+ c.include Fakeout::SpecHelpers
36
46
  end
37
47
 
38
- h2. Test::Unit
48
+ p. * Note that if you use @SpecHelpers@ with RSpec, you DO NOT need to include @TestHelpers@.
39
49
 
40
- bc.. # something_test.rb
41
- require "fakeout/test_helpers"
50
+ h2. Test::Unit
42
51
 
43
- class SomethingTest < Test::Unit::TestCase
52
+ bc.. class SomethingTest < Test::Unit::TestCase
44
53
  include Fakeout::TestHelpers
45
54
 
46
55
  def setup
@@ -52,14 +61,17 @@ class SomethingTest < Test::Unit::TestCase
52
61
  end
53
62
  end
54
63
 
55
- h2. Helpers
64
+ h2. Installation
56
65
 
57
- Fakeout exposes two string-like objects:
66
+ bc.. $ gem install fakeout
58
67
 
59
- @stdout@ : Anything sent to @$stdout@.
60
- @stderr@ : Anything sent to @$stderr@.
68
+ h2. Contribution
61
69
 
62
- bc.. it "should write output" do
63
- thing.that_outputs_to_stdout
64
- stdout.should include "ohai"
65
- end
70
+ 1. Fork Fakeout
71
+ 2. Create a topic branch - @git checkout -b branch_name@
72
+ 3. Push branch to your fork - @git push origin branch_name@
73
+ 4. Send a pull request
74
+
75
+ h2. Thanks
76
+
77
+ Defunkt for FakeFS, which much of Fakeout is modeled after.
@@ -1,2 +1,2 @@
1
- require "stringio"
2
- require "fakeout/base"
1
+ require "fakeout/safe"
2
+ Fakeout.activate!
@@ -14,6 +14,6 @@ module Fakeout
14
14
  end
15
15
 
16
16
  def self.is_active?
17
- @is_active
17
+ !!@is_active
18
18
  end
19
19
  end
@@ -0,0 +1,4 @@
1
+ require "stringio"
2
+ require "fakeout/base"
3
+ require "fakeout/test_helpers"
4
+ require "fakeout/spec_helpers"
@@ -1,5 +1,3 @@
1
- require "fakeout/test_helpers"
2
-
3
1
  module Fakeout
4
2
  module SpecHelpers
5
3
  include TestHelpers
@@ -1,5 +1,3 @@
1
- require "fakeout"
2
-
3
1
  module Fakeout
4
2
  module TestHelpers
5
3
  def stdout
@@ -1,3 +1,3 @@
1
1
  module Fakeout
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,8 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fakeout
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.1
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 2
9
+ version: 0.0.2
6
10
  platform: ruby
7
11
  authors:
8
12
  - Matte Noble
@@ -10,7 +14,8 @@ autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
16
 
13
- date: 2011-04-29 00:00:00 Z
17
+ date: 2011-04-29 00:00:00 -04:00
18
+ default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: rspec
@@ -20,6 +25,10 @@ dependencies:
20
25
  requirements:
21
26
  - - ">="
22
27
  - !ruby/object:Gem::Version
28
+ segments:
29
+ - 2
30
+ - 5
31
+ - 0
23
32
  version: 2.5.0
24
33
  type: :development
25
34
  version_requirements: *id001
@@ -40,11 +49,13 @@ files:
40
49
  - fakeout.gemspec
41
50
  - lib/fakeout.rb
42
51
  - lib/fakeout/base.rb
52
+ - lib/fakeout/safe.rb
43
53
  - lib/fakeout/spec_helpers.rb
44
54
  - lib/fakeout/test_helpers.rb
45
55
  - lib/fakeout/version.rb
46
56
  - spec/fakeout_spec.rb
47
57
  - test/fakeout_test.rb
58
+ has_rdoc: true
48
59
  homepage: http://github.com/mnoble/fakeout
49
60
  licenses: []
50
61
 
@@ -58,17 +69,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
58
69
  requirements:
59
70
  - - ">="
60
71
  - !ruby/object:Gem::Version
72
+ segments:
73
+ - 0
61
74
  version: "0"
62
75
  required_rubygems_version: !ruby/object:Gem::Requirement
63
76
  none: false
64
77
  requirements:
65
78
  - - ">="
66
79
  - !ruby/object:Gem::Version
80
+ segments:
81
+ - 0
67
82
  version: "0"
68
83
  requirements: []
69
84
 
70
85
  rubyforge_project:
71
- rubygems_version: 1.7.2
86
+ rubygems_version: 1.3.7
72
87
  signing_key:
73
88
  specification_version: 3
74
89
  summary: Fakeout captures STDOUT and STDERR for command line testing.