ariete 1.0.3 → 1.1.0

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: 87f145110f6614256842c7e00d01d86c576056c8
4
- data.tar.gz: 7e093b45f4794de537cb236ccea9b11e4f799078
3
+ metadata.gz: 51f373415838605eea31e439980dfcc2b6e2064d
4
+ data.tar.gz: 538dcb2f5272b0614f67c23b323604df3748be94
5
5
  SHA512:
6
- metadata.gz: a5a1dd70dbed7549a9f4aea44180ab7ad1d58ca374665256bd8c1fa0a1f84fa576c2960f05dd6bd6eab2e48ae9a057b3e3672effd175336459ca31b49d299178
7
- data.tar.gz: dacc47508331b6130c6e34b056c751c27e962365a681b2e53a1cc3f88922e0e92ae9d6073219b74f31796d4d80fb95067304bdc9d5983f66787687c6b7bf5be5
6
+ metadata.gz: 28147b8d4fc07e3933414a21d0c6ed25767b89ed78c434ebd705ff248b84254cc822df676641de4e2b60562e30b53c5bbc7d22bb0564303d0be447cc9bad3a15
7
+ data.tar.gz: b61f1f34da11e3046cb7854fe72e682e688d6acaa10b2259a9fd777a3922a47036d71367c96bbc6f535831b43a70cc321f248eaa4a60eaa41fdf4b66237739c5
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  pkg/
2
2
  doc/
3
3
  vendor/bundle
4
+ .bundle
4
5
  .DS_Store
@@ -1,6 +1,10 @@
1
1
  language: ruby
2
+ sudo: false
2
3
  rvm:
3
- - 2.1.3
4
+ - 2.0.0
5
+ - 2.1.7
6
+ - 2.2.3
7
+ - 2.3.0
4
8
  notifications:
5
9
  on_success: change
6
10
  on_failure: change
@@ -1,27 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ariete (1.0.3)
5
- rspec
4
+ ariete (1.1.0)
6
5
 
7
6
  GEM
8
7
  remote: https://rubygems.org/
9
8
  specs:
10
- diff-lcs (1.2.5)
9
+ power_assert (0.2.7)
11
10
  rake (10.3.2)
12
- rspec (3.3.0)
13
- rspec-core (~> 3.3.0)
14
- rspec-expectations (~> 3.3.0)
15
- rspec-mocks (~> 3.3.0)
16
- rspec-core (3.3.2)
17
- rspec-support (~> 3.3.0)
18
- rspec-expectations (3.3.1)
19
- diff-lcs (>= 1.2.0, < 2.0)
20
- rspec-support (~> 3.3.0)
21
- rspec-mocks (3.3.2)
22
- diff-lcs (>= 1.2.0, < 2.0)
23
- rspec-support (~> 3.3.0)
24
- rspec-support (3.3.0)
11
+ test-unit (3.1.7)
12
+ power_assert
25
13
 
26
14
  PLATFORMS
27
15
  ruby
@@ -30,6 +18,7 @@ DEPENDENCIES
30
18
  ariete!
31
19
  bundler (~> 1.7)
32
20
  rake (~> 10.0)
21
+ test-unit
33
22
 
34
23
  BUNDLED WITH
35
- 1.10.6
24
+ 1.11.2
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Ariete
2
2
 
3
+ [![Build Status](https://travis-ci.org/mozamimy/ariete.svg?branch=develop)](https://travis-ci.org/mozamimy/ariete)
4
+
3
5
  Ariete is a module that captures $stdout($stderr) and return as String.
4
6
  It is useful on an unit test.
5
7
 
@@ -13,76 +15,48 @@ It is useful on an unit test.
13
15
  $ (sudo) gem install 'ariete'
14
16
  ```
15
17
 
16
- ## Usage
17
-
18
- ### rspec
18
+ ## Usage with test-unit
19
19
 
20
- #### klass.rb
20
+ ### klass.rb
21
21
 
22
22
  ```ruby
23
23
  class Klass
24
24
  class << self
25
- def output_out
25
+ def output
26
26
  puts "Ariete is a kind of rabbit."
27
- end
28
-
29
- def output_err
30
27
  warn "Ariete means 'Lop' in Italian."
31
28
  end
32
29
  end
33
30
  end
34
31
  ```
35
32
 
36
- #### klass_spec.rb
33
+ ### klass_spec.rb
37
34
 
38
35
  ```ruby
39
- require "ariete"
40
- require_relative "klass"
36
+ require 'test/unit'
37
+ require 'ariete'
38
+ require_relative 'klass'
41
39
 
42
- RSpec.describe Klass do
40
+ class TestKlass < Test::Unit::TestCase
43
41
  include Ariete
44
42
 
45
- # Ariete extends matchers of RSpec.
46
- # Therefore, you can use 'be_output' and 'be_output_to_stderr'.
47
- describe ".output_out" do
48
- subject { Klass.method(:output_out).to_proc }
49
- it { expect(subject).to be_output "Ariete is a kind of rabbit.\n" }
50
- end
51
-
52
- describe ".output_out (an alternate expression)" do
53
- subject { -> { Klass.output_out } }
54
- it { expect(subject).to be_output "Ariete is a kind of rabbit.\n" }
55
- end
56
-
57
- describe ".output_err" do
58
- subject { Klass.method(:output_err).to_proc }
59
- it { expect(subject).to be_output_to_stderr "Ariete means 'Lop' in Italian.\n" }
43
+ def test_output_std
44
+ captured_string = capture_stdout { Klass.output }
45
+ assert_equal "Ariete is a kind of rabbit.\n", captured_string
60
46
  end
61
47
 
62
- # You can use without 'Ariete.' if you include Ariete.
63
- describe ".output_out" do
64
- subject { capture_stdout { Klass.output_out } }
65
- it { expect(subject).to eq "Ariete is a kind of rabbit.\n" }
66
- end
67
-
68
- describe ".output_err" do
69
- subject { capture_stderr { Klass.output_err } }
70
- it { expect(subject).to eq "Ariete means 'Lop' in Italian.\n" }
71
- end
72
-
73
- # Also you can use as 'Ariete.capture_xxx'
74
- describe ".output_out" do
75
- subject { Ariete.capture_stdout { Klass.output_out } }
76
- it { expect(subject).to eq "Ariete is a kind of rabbit.\n" }
77
- end
78
-
79
- describe ".output_err" do
80
- subject { Ariete.capture_stderr { Klass.output_err } }
81
- it { expect(subject).to eq "Ariete means 'Lop' in Italian.\n" }
48
+ def test_output_err
49
+ captured_string = capture_stderr { Klass.output }
50
+ assert_equal "Ariete means 'Lop' in Italian.\n", captured_string
82
51
  end
83
52
  end
84
53
  ```
85
54
 
55
+ ## with RSpec
56
+
57
+ Do you want some matchers for RSpec?
58
+ You can use [ariete-rspec](https://github.com/mozamimy/ariete-rspec) gem to extend RSpec.
59
+
86
60
  ## Contributing
87
61
 
88
62
  1. Fork it ( https://github.com/mozamimy/ariete/fork )
data/Rakefile CHANGED
@@ -1,6 +1,11 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
3
 
4
- RSpec::Core::RakeTask.new(:spec)
4
+ desc 'Run tests'
5
+ Rake::TestTask.new do |t|
6
+ t.libs << 'test'
7
+ t.test_files = Dir['test/**/test_*.rb']
8
+ t.verbose = true
9
+ end
5
10
 
6
- task default: :spec
11
+ task default: :test
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_dependency "rspec"
21
20
  spec.add_development_dependency "bundler", "~> 1.7"
22
21
  spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "test-unit"
23
23
  end
@@ -1,8 +1,3 @@
1
- # Ariete
2
- # Copyright (c) 2014 Moza USANE
3
- # This software is released under the MIT License.
4
- # http://opensource.org/licenses/mit-license.php
5
- require "rspec"
6
1
  require "stringio"
7
2
 
8
3
  module Ariete
@@ -24,15 +19,3 @@ module Ariete
24
19
  module_function "capture_#{name}"
25
20
  end
26
21
  end
27
-
28
- RSpec::Matchers.define :be_output do |expect|
29
- match do |actual|
30
- Ariete.capture_stdout { actual.call } == expect.to_s
31
- end
32
- end
33
-
34
- RSpec::Matchers.define :be_output_to_stderr do |expect|
35
- match do |actual|
36
- Ariete.capture_stderr { actual.call } == expect.to_s
37
- end
38
- end
@@ -1,3 +1,3 @@
1
1
  module Ariete
2
- VERSION = "1.0.3"
2
+ VERSION = '1.1.0'
3
3
  end
@@ -0,0 +1,34 @@
1
+ require 'test_helper'
2
+
3
+ class TestAriete < Test::Unit::TestCase
4
+ include Ariete
5
+
6
+ def output
7
+ puts "Ariete is a kind of rabbit."
8
+ warn "Ariete means 'Lop' in Italian."
9
+ end
10
+
11
+ def test_version
12
+ assert_equal '1.1.0', Ariete::VERSION
13
+ end
14
+
15
+ def test_capture_stdout
16
+ captured_string = capture_stdout { output }
17
+ assert_equal "Ariete is a kind of rabbit.\n", captured_string
18
+ end
19
+
20
+ def test_capture_stderr
21
+ captured_string = capture_stderr { output }
22
+ assert_equal "Ariete means 'Lop' in Italian.\n", captured_string
23
+ end
24
+
25
+ def test_capture_stdout_as_module_function
26
+ captured_string = Ariete.capture_stdout { output }
27
+ assert_equal "Ariete is a kind of rabbit.\n", captured_string
28
+ end
29
+
30
+ def test_capture_stderr_as_module_function
31
+ captured_string = Ariete.capture_stderr { output }
32
+ assert_equal "Ariete means 'Lop' in Italian.\n", captured_string
33
+ end
34
+ end
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+ require 'ariete'
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ariete
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moza USANE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-16 00:00:00.000000000 Z
11
+ date: 2016-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rspec
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: bundler
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +38,20 @@ dependencies:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
40
  version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: test-unit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
55
  description: Ariete is capturing module for STDOUT & STDERR.
56
56
  email:
57
57
  - mozamimy@quellencode.org
@@ -70,8 +70,8 @@ files:
70
70
  - ariete.gemspec
71
71
  - lib/ariete.rb
72
72
  - lib/ariete/version.rb
73
- - spec/ariete_spec.rb
74
- - spec/spec_helper.rb
73
+ - test/test_ariete.rb
74
+ - test/test_helper.rb
75
75
  homepage: http://quellencode.org/
76
76
  licenses:
77
77
  - MIT
@@ -92,10 +92,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  requirements: []
94
94
  rubyforge_project:
95
- rubygems_version: 2.4.5.1
95
+ rubygems_version: 2.5.1
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: Ariete is capturing module for STDOUT & STDERR.
99
99
  test_files:
100
- - spec/ariete_spec.rb
101
- - spec/spec_helper.rb
100
+ - test/test_ariete.rb
101
+ - test/test_helper.rb
@@ -1,49 +0,0 @@
1
- # Ariete
2
- # Copyright (c) 2014 Moza USANE
3
- # This software is released under the MIT License.
4
- # http://opensource.org/licenses/mit-license.php
5
-
6
- require "spec_helper"
7
-
8
- RSpec.describe Ariete do
9
- include Ariete
10
-
11
- def output
12
- puts "Ariete is a kind of rabbit."
13
- warn "Ariete means 'Lop' in Italian."
14
- end
15
-
16
- describe "#capture_stdout" do
17
- subject { capture_stdout { output } }
18
- it { expect(subject).to eq "Ariete is a kind of rabbit.\n" }
19
- end
20
-
21
- describe "#capture_stderr" do
22
- subject { capture_stderr { output } }
23
- it { expect(subject).to eq "Ariete means 'Lop' in Italian.\n" }
24
- end
25
-
26
- describe "module_function" do
27
- describe "#capture_stdout" do
28
- subject { Ariete.capture_stdout { output } }
29
- it { expect(subject).to eq "Ariete is a kind of rabbit.\n" }
30
- end
31
-
32
- describe "#capture_stderr" do
33
- subject { Ariete.capture_stderr { output } }
34
- it { expect(subject).to eq "Ariete means 'Lop' in Italian.\n" }
35
- end
36
- end
37
-
38
- describe "custom matchers" do
39
- describe "#be_output" do
40
- subject { method(:output).to_proc }
41
- it { expect(subject).to be_output "Ariete is a kind of rabbit.\n" }
42
- end
43
-
44
- describe "#be_output_to_stderr" do
45
- subject { method(:output).to_proc }
46
- it { expect(subject).to be_output_to_stderr "Ariete means 'Lop' in Italian.\n" }
47
- end
48
- end
49
- end
@@ -1,2 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
- require 'ariete'