stdout 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99f5920c4696438e1b2533cd737f7542b3696c10
4
- data.tar.gz: a8158dc7f4b1b53d78d222d846c153f0402e901d
3
+ metadata.gz: f58ed09708992276ba4d2c4265a815d7dd16aefd
4
+ data.tar.gz: efefd9aa6bb94727ddcd5e34d929eb0ff416081a
5
5
  SHA512:
6
- metadata.gz: cd01fbe0866774b7101db3a29ff7bbbb9a4be8d96be8bb81cd3fc21e8ee80404b1754c68cc84cd33d43957ecfb75b25f417676bccd16371417f171ea0684cb70
7
- data.tar.gz: a6a286d11780ff56fb724e6bbd6cbd68e28832216cf3d85dd9f5c432b76d4fa217c3934880ec79bc427148fde60281c10cb8a534144f8f7d8cdaabcbde9723bb
6
+ metadata.gz: 5c093cd73eee4fbf2cba192af4458d1d5e2f096b4cc888a130c93e7d8d3e7ba8c1735b73f016621ef49d1ae605474da5dd71f3b178d6a0b12112914237a965a0
7
+ data.tar.gz: 29c5b28f86ba730dae1627bb2d30bff77555a4fa99beb5bdc7689e7859b66676a623070cfa123cc2335cb71491c748ec47c91c16bd0ea273cb33e7af6990664c
data/Gemfile CHANGED
@@ -1,9 +1,9 @@
1
- # Version:20120317
1
+ # Version:20131125
2
2
 
3
3
  source :rubygems
4
4
 
5
5
  group :test do
6
- gem 'rspec'
6
+ gem 'rspec', '~> 2.14.0'
7
7
  gem 'rcov', :platforms => :mri_18
8
8
  gem 'simplecov'
9
9
  gem 'simplecov-rcov'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -1,3 +1,10 @@
1
+ === 0.0.3 / 2013-12-13
2
+
3
+ * New syntax for rspec codes.
4
+
5
+ * Refactoring.
6
+
7
+
1
8
  === 0.0.2 / 2013-11-12
2
9
 
3
10
  * Save before status of stdout.
@@ -2,11 +2,11 @@
2
2
  # Name:: Stdout
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Nov 11, 2013
5
- # Updated:: Nov 12, 2013
5
+ # Updated:: Nov 22, 2013
6
6
  # Copyright:: 774 <http://id774.net> Copyright (c) 2013
7
7
  # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
8
8
 
9
9
  module Stdout
10
- VERSION = "0.0.2"
11
10
  require File.dirname(__FILE__) + "/stdout/output"
11
+ require File.dirname(__FILE__) + "/stdout/version"
12
12
  end
@@ -0,0 +1,10 @@
1
+ # Name:: Stdout::Version
2
+ # Author:: 774 <http://id774.net>
3
+ # Created:: Nov 22, 2013
4
+ # Updated:: Dec 13, 2013
5
+ # Copyright:: 774 Copyright (c) 2013
6
+ # License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
7
+
8
+ module Stdout
9
+ VERSION = "0.0.3"
10
+ end
@@ -0,0 +1,178 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require File.dirname(__FILE__) + '/../../spec_helper'
4
+
5
+ describe Stdout::Output do
6
+
7
+ describe '#capture' do
8
+
9
+ context 'giving block of a put' do
10
+ subject { Stdout::Output.capture { puts "hoge" } }
11
+
12
+ let(:expected) { ["hoge\n"] }
13
+
14
+ it 'should return array object' do
15
+ expect(subject).to eq expected
16
+ end
17
+ end
18
+
19
+ context 'giving block of puts' do
20
+ subject {
21
+ Stdout::Output.capture {
22
+ puts "aaa"
23
+ puts "bbb"
24
+ puts "ccc"
25
+ }
26
+ }
27
+
28
+ let(:expected) { [
29
+ "aaa\n",
30
+ "bbb\n",
31
+ "ccc\n"
32
+ ]
33
+ }
34
+
35
+ it "should return array object" do
36
+ expect(subject).to eq expected
37
+ end
38
+ end
39
+
40
+ context 'giving block of print method' do
41
+ subject {
42
+ Stdout::Output.capture {
43
+ print_method
44
+ }
45
+ }
46
+
47
+ def print_method
48
+ result = 1 + 2
49
+ puts "Answer is #{result}."
50
+ end
51
+
52
+ let(:expected) {
53
+ [ "Answer is 3.\n" ]
54
+ }
55
+
56
+ it "should return array object" do
57
+ expect(subject).to eq expected
58
+ end
59
+ end
60
+
61
+ context 'giving block of prints method' do
62
+ subject {
63
+ Stdout::Output.capture {
64
+ prints_method
65
+ }
66
+ }
67
+
68
+ def prints_method
69
+ puts "Job start"
70
+ puts "Now processing..."
71
+ puts "Done!"
72
+ end
73
+
74
+ let(:expected) {
75
+ [
76
+ "Job start\n",
77
+ "Now processing...\n",
78
+ "Done!\n"
79
+ ]
80
+ }
81
+
82
+ it "should return array object" do
83
+ expect(subject).to eq expected
84
+ end
85
+ end
86
+
87
+ context 'giving block of puts' do
88
+ subject {
89
+ Stdout::Output.capture {
90
+ puts "aaa"
91
+ puts "bbb"
92
+ puts "ccc"
93
+ }
94
+ }
95
+
96
+ class OutputMock
97
+ def write(msg); end
98
+ end
99
+
100
+ it "should save stdout status" do
101
+ subject
102
+
103
+ output = OutputMock.new
104
+ expect($stdout).to equal STDOUT
105
+ expect($stdout).not_to equal output
106
+
107
+ $stdout = output
108
+
109
+ subject
110
+
111
+ expect($stdout).not_to equal STDOUT
112
+ expect($stdout).to equal output
113
+ end
114
+ end
115
+
116
+ end
117
+
118
+ describe '#capture with separator "\r"' do
119
+
120
+ context 'giving block of prints method' do
121
+ subject {
122
+ Stdout::Output.capture (sep = "\r") {
123
+ prints_method_with_r
124
+ }
125
+ }
126
+
127
+ def prints_method_with_r
128
+ print "Job start\r"
129
+ print "Now processing...\r"
130
+ print "Done!\r"
131
+ end
132
+
133
+ let(:expected) {
134
+ [
135
+ "Job start\r",
136
+ "Now processing...\r",
137
+ "Done!\r"
138
+ ]
139
+ }
140
+
141
+ it "should return array object" do
142
+ expect(subject).to eq expected
143
+ end
144
+ end
145
+
146
+ end
147
+
148
+ context '#capture with separator "\n"' do
149
+
150
+ context 'giving block of prints method' do
151
+ subject {
152
+ result = Stdout::Output.capture (sep = "\n") {
153
+ prints_method_with_n
154
+ }
155
+ }
156
+
157
+ def prints_method_with_n
158
+ print "Job start\n"
159
+ print "Now processing...\n"
160
+ print "Done!\n"
161
+ end
162
+
163
+ let(:expected) {
164
+ [
165
+ "Job start\n",
166
+ "Now processing...\n",
167
+ "Done!\n"
168
+ ]
169
+ }
170
+
171
+ it "should return array object" do
172
+ expect(subject).to eq expected
173
+ end
174
+ end
175
+
176
+ end
177
+
178
+ end
@@ -3,11 +3,9 @@
3
3
  require File.dirname(__FILE__) + '/../spec_helper'
4
4
 
5
5
  describe Stdout do
6
- context 'const get :VERSION should' do
7
- it "return right version number" do
8
- expect = '0.0.2'
9
- Stdout.const_get(:VERSION).should be_true
10
- Stdout.const_get(:VERSION).should eq expect
11
- end
6
+ context "VERSION" do
7
+ subject { Stdout::VERSION }
8
+
9
+ it { expect(subject).to eq "0.0.3" }
12
10
  end
13
11
  end
@@ -2,15 +2,15 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: stdout 0.0.2 ruby lib
5
+ # stub: stdout 0.0.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "stdout"
9
- s.version = "0.0.2"
9
+ s.version = "0.0.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["id774"]
13
- s.date = "2013-11-12"
13
+ s.date = "2013-12-13"
14
14
  s.description = "Change stdout to array object"
15
15
  s.email = "idnanashi@gmail.com"
16
16
  s.extra_rdoc_files = [
@@ -30,9 +30,10 @@ Gem::Specification.new do |s|
30
30
  "doc/LICENSE",
31
31
  "lib/stdout.rb",
32
32
  "lib/stdout/output.rb",
33
+ "lib/stdout/version.rb",
33
34
  "script/.gitkeep",
34
35
  "script/build",
35
- "spec/lib/stdout/stdout_spec.rb",
36
+ "spec/lib/stdout/output_spec.rb",
36
37
  "spec/lib/stdout_spec.rb",
37
38
  "spec/spec_helper.rb",
38
39
  "stdout.gemspec",
@@ -41,7 +42,7 @@ Gem::Specification.new do |s|
41
42
  s.homepage = "http://github.com/id774/stdout"
42
43
  s.licenses = ["GPL"]
43
44
  s.require_paths = ["lib"]
44
- s.rubygems_version = "2.1.9"
45
+ s.rubygems_version = "2.1.11"
45
46
  s.summary = "Stdout"
46
47
 
47
48
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stdout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - id774
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-12 00:00:00.000000000 Z
11
+ date: 2013-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -72,9 +72,10 @@ files:
72
72
  - doc/LICENSE
73
73
  - lib/stdout.rb
74
74
  - lib/stdout/output.rb
75
+ - lib/stdout/version.rb
75
76
  - script/.gitkeep
76
77
  - script/build
77
- - spec/lib/stdout/stdout_spec.rb
78
+ - spec/lib/stdout/output_spec.rb
78
79
  - spec/lib/stdout_spec.rb
79
80
  - spec/spec_helper.rb
80
81
  - stdout.gemspec
@@ -99,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
100
  version: '0'
100
101
  requirements: []
101
102
  rubyforge_project:
102
- rubygems_version: 2.1.9
103
+ rubygems_version: 2.1.11
103
104
  signing_key:
104
105
  specification_version: 4
105
106
  summary: Stdout
@@ -1,167 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- require File.dirname(__FILE__) + '/../../spec_helper'
4
-
5
- describe Stdout::Output do
6
-
7
- context 'capture method with no arguments' do
8
-
9
- describe 'giving block of a put' do
10
- it "should return array object" do
11
- expected = ["hoge\n"]
12
-
13
- result = Stdout::Output.capture { puts "hoge" }
14
- result.should eq expected
15
- end
16
- end
17
-
18
- describe 'giving block of puts' do
19
- it "should return array object" do
20
-
21
- expected = [
22
- "aaa\n",
23
- "bbb\n",
24
- "ccc\n"
25
- ]
26
-
27
- result = Stdout::Output.capture {
28
- puts "aaa"
29
- puts "bbb"
30
- puts "ccc"
31
- }
32
-
33
- result.should eq expected
34
- end
35
- end
36
-
37
- describe 'giving block of print method' do
38
- it "should return array object" do
39
-
40
- def print_method
41
- result = 1 + 2
42
- puts "Answer is #{result}."
43
- end
44
-
45
- expected = [
46
- "Answer is 3.\n"
47
- ]
48
-
49
- result = Stdout::Output.capture {
50
- print_method
51
- }
52
-
53
- result.should eq expected
54
- end
55
- end
56
-
57
- describe 'giving block of prints method' do
58
- it "should return array object" do
59
-
60
- def prints_method
61
- puts "Job start"
62
- puts "Now processing..."
63
- puts "Done!"
64
- end
65
-
66
- expected = [
67
- "Job start\n",
68
- "Now processing...\n",
69
- "Done!\n"
70
- ]
71
-
72
- result = Stdout::Output.capture {
73
- prints_method
74
- }
75
-
76
- result.should eq expected
77
- end
78
- end
79
-
80
- describe 'giving block of puts' do
81
- it "should save stdout status" do
82
-
83
- class OutputMock
84
- def write(msg); end
85
- end
86
-
87
- output = OutputMock.new
88
-
89
- Stdout::Output.capture {
90
- puts "aaa"
91
- puts "bbb"
92
- puts "ccc"
93
- }
94
-
95
- $stdout.should equal STDOUT
96
- $stdout.should_not equal output
97
-
98
- $stdout = output
99
-
100
- Stdout::Output.capture {
101
- puts "aaa"
102
- puts "bbb"
103
- puts "ccc"
104
- }
105
-
106
- $stdout.should_not equal STDOUT
107
- $stdout.should equal output
108
- end
109
- end
110
-
111
- end
112
-
113
- context 'capture method with separator "\r"' do
114
-
115
- describe 'giving block of prints method' do
116
- it "should return array object" do
117
-
118
- def prints_method_with_r
119
- print "Job start\r"
120
- print "Now processing...\r"
121
- print "Done!\r"
122
- end
123
-
124
- expected = [
125
- "Job start\r",
126
- "Now processing...\r",
127
- "Done!\r"
128
- ]
129
-
130
- result = Stdout::Output.capture (sep = "\r") {
131
- prints_method_with_r
132
- }
133
-
134
- result.should eq expected
135
- end
136
- end
137
-
138
- end
139
-
140
- context 'capture method with separator "\n"' do
141
-
142
- describe 'giving block of prints method' do
143
- it "should return array object" do
144
-
145
- def prints_method_with_n
146
- print "Job start\n"
147
- print "Now processing...\n"
148
- print "Done!\n"
149
- end
150
-
151
- expected = [
152
- "Job start\n",
153
- "Now processing...\n",
154
- "Done!\n"
155
- ]
156
-
157
- result = Stdout::Output.capture (sep = "\n") {
158
- prints_method_with_n
159
- }
160
-
161
- result.should eq expected
162
- end
163
- end
164
-
165
- end
166
-
167
- end