fakeout 0.0.1 → 0.0.2
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.textile +42 -30
- data/lib/fakeout.rb +2 -2
- data/lib/fakeout/base.rb +1 -1
- data/lib/fakeout/safe.rb +4 -0
- data/lib/fakeout/spec_helpers.rb +0 -2
- data/lib/fakeout/test_helpers.rb +0 -2
- data/lib/fakeout/version.rb +1 -1
- metadata +19 -4
data/README.textile
CHANGED
@@ -1,46 +1,55 @@
|
|
1
1
|
h1. Fakeout
|
2
2
|
|
3
|
-
Fakeout
|
3
|
+
Fakeout is an easy way of testing the output of your command line tools and libraries.
|
4
4
|
|
5
|
-
|
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
|
-
|
7
|
+
h2. Usage
|
8
8
|
|
9
|
-
|
9
|
+
To load and activate Fakeout:
|
10
10
|
|
11
|
-
|
11
|
+
bc.. require "fakeout"
|
12
12
|
|
13
|
-
|
13
|
+
h3. Manually Activate and Deactivate
|
14
14
|
|
15
|
-
|
16
|
-
c.include Fakeout::SpecHelpers
|
17
|
-
end
|
15
|
+
If you want to control when Fakeout starts and stops capturing output:
|
18
16
|
|
19
|
-
|
17
|
+
bc.. require "fakeout/safe"
|
20
18
|
|
21
|
-
|
19
|
+
Fakeout.activate!
|
20
|
+
# your code
|
21
|
+
Fakeout.deactivate!
|
22
22
|
|
23
|
-
|
24
|
-
|
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
|
-
|
34
|
+
h2. RSpec
|
28
35
|
|
29
|
-
|
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
|
-
|
35
|
-
|
44
|
+
bc.. RSpec.config do |c|
|
45
|
+
c.include Fakeout::SpecHelpers
|
36
46
|
end
|
37
47
|
|
38
|
-
|
48
|
+
p. * Note that if you use @SpecHelpers@ with RSpec, you DO NOT need to include @TestHelpers@.
|
39
49
|
|
40
|
-
|
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.
|
64
|
+
h2. Installation
|
56
65
|
|
57
|
-
|
66
|
+
bc.. $ gem install fakeout
|
58
67
|
|
59
|
-
|
60
|
-
@stderr@ : Anything sent to @$stderr@.
|
68
|
+
h2. Contribution
|
61
69
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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.
|
data/lib/fakeout.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require "
|
2
|
-
|
1
|
+
require "fakeout/safe"
|
2
|
+
Fakeout.activate!
|
data/lib/fakeout/base.rb
CHANGED
data/lib/fakeout/safe.rb
ADDED
data/lib/fakeout/spec_helpers.rb
CHANGED
data/lib/fakeout/test_helpers.rb
CHANGED
data/lib/fakeout/version.rb
CHANGED
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
|
-
|
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
|
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
|
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.
|