tiramisu 0.0.0 → 0.0.1

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.
@@ -0,0 +1,42 @@
1
+ describe :refute_throw do
2
+
3
+ it 'should pass when nothing thrown' do
4
+ this = self
5
+ spec rand do
6
+ test(:test) {refute {}.throw}
7
+ this.assert_equal :__tiramisu_passed__, run(:test)
8
+ end
9
+ end
10
+
11
+ it 'should fail when something thrown' do
12
+ this = self
13
+ spec rand do
14
+ test(:test) {refute {throw :x}.throw}
15
+ this.assert_equal Tiramisu::GenericFailure, run(:test).class
16
+ end
17
+ end
18
+
19
+ it 'should pass when thrown symbol does not match negated one' do
20
+ this = self
21
+ spec rand do
22
+ test(:test) {refute {throw :x}.throw(:y)}
23
+ this.assert_equal :__tiramisu_passed__, run(:test)
24
+ end
25
+ end
26
+
27
+ it 'should fail when thrown symbol does match negated one' do
28
+ this = self
29
+ spec rand do
30
+ test(:test) {refute {throw :x}.throw(:x)}
31
+ this.assert_equal Tiramisu::GenericFailure, run(:test).class
32
+ end
33
+ end
34
+
35
+ it 'should fail when a negated symbol given and nothing thrown' do
36
+ this = self
37
+ spec rand do
38
+ test(:test) {refute {}.throw(:x)}
39
+ this.assert_equal Tiramisu::GenericFailure, run(:test).class
40
+ end
41
+ end
42
+ end
data/test/setup.rb ADDED
@@ -0,0 +1,25 @@
1
+ require 'json'
2
+ require 'minitest/autorun'
3
+ require 'tiramisu'
4
+
5
+ module Minitest
6
+ class Mock
7
+ def respond_to?(sym, include_private = false)
8
+ retval = __respond_to?(sym, include_private)
9
+ if @expected_calls.key?(:respond_to?)
10
+ @actual_calls[:respond_to?] << {retval: retval, args: [sym, include_private]}
11
+ end
12
+ retval
13
+ end
14
+ end
15
+ end
16
+
17
+ def proxy obj
18
+ Tiramisu::Assert.new(returned: obj)
19
+ end
20
+
21
+ def mock meth, *args, &block
22
+ m = Minitest::Mock.new
23
+ m.expect(meth, true, args, &block)
24
+ proxy(m)
25
+ end
data/test/skip_test.rb ADDED
@@ -0,0 +1,40 @@
1
+ describe :skip do
2
+
3
+ it 'should skip inside spec' do
4
+ r, w = IO.pipe
5
+ fork do
6
+ r.close
7
+ s = Tiramisu.define_spec :skip_spec, proc {
8
+ test(:a) {}
9
+ skip
10
+ test(:b) {}
11
+ }
12
+ w.print({skips: Tiramisu.skips.size, tests: s.tests.size}.to_json)
13
+ end
14
+ w.close
15
+ data = JSON.parse(r.read)
16
+ assert_equal 1, data['skips']
17
+ assert_equal 1, data['tests']
18
+ end
19
+
20
+ it 'should skip inside test' do
21
+ r, w = IO.pipe
22
+ fork do
23
+ r.close
24
+ buffer = []
25
+ Tiramisu.define_and_register_a_spec :skip_test, proc {
26
+ test :x do
27
+ buffer << 'a'
28
+ skip
29
+ buffer << 'b'
30
+ end
31
+ }
32
+ Tiramisu.run
33
+ w.print({skips: Tiramisu.skips.size, buffer: buffer}.to_json)
34
+ end
35
+ w.close
36
+ data = JSON.parse(r.read)
37
+ assert_equal 1, data['skips']
38
+ assert_equal ["a"], data['buffer']
39
+ end
40
+ end
@@ -0,0 +1,58 @@
1
+ describe :throw do
2
+
3
+ it 'should pass when any symbol expected and something thrown' do
4
+ this = self
5
+ spec rand do
6
+ test(:test) {assert {throw :x}.throw}
7
+ this.assert_equal :__tiramisu_passed__, run(:test)
8
+ end
9
+ end
10
+
11
+ it 'should pass when specific symbol expected and thrown' do
12
+ this = self
13
+ spec rand do
14
+ test(:test) {assert {throw :x}.throw(:x)}
15
+ this.assert_equal :__tiramisu_passed__, run(:test)
16
+ end
17
+ end
18
+
19
+ it 'should fail when any throw expected but nothing thrown' do
20
+ this = self
21
+ spec rand do
22
+ test(:test) {assert {}.throw}
23
+ this.assert_equal Tiramisu::GenericFailure, run(:test).class
24
+ end
25
+ end
26
+
27
+ it 'should fail when specific symbol expected but nothing thrown' do
28
+ this = self
29
+ spec rand do
30
+ test(:test) {assert {}.throw(:x)}
31
+ this.assert_equal Tiramisu::GenericFailure, run(:test).class
32
+ end
33
+ end
34
+
35
+ it 'should fail when wrong symbol thrown' do
36
+ this = self
37
+ spec rand do
38
+ test(:test) {assert {throw :y}.throw(:x)}
39
+ this.assert_equal Tiramisu::GenericFailure, run(:test).class
40
+ end
41
+ end
42
+
43
+ it 'should pass when given block validates thrown symbol' do
44
+ this = self
45
+ spec rand do
46
+ test(:test) {assert {throw :x}.throw {|s| s == :x}}
47
+ this.assert_equal :__tiramisu_passed__, run(:test)
48
+ end
49
+ end
50
+
51
+ it 'should fail when given block invalidates thrown symbol' do
52
+ this = self
53
+ spec rand do
54
+ test(:test) {assert {}.throw {false}}
55
+ this.assert_equal Tiramisu::GenericFailure, run(:test).class
56
+ end
57
+ end
58
+ end
data/tiramisu.gemspec CHANGED
@@ -1,12 +1,12 @@
1
1
  # coding: utf-8
2
2
 
3
- name, version = 'tiramisu 0.0.0'.split
3
+ name, version = 'tiramisu 0.0.1'.split
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = name
6
6
  spec.version = version
7
7
  spec.authors = ['Slee Woo']
8
8
  spec.email = ['mail@sleewoo.com']
9
- spec.description = name
9
+ spec.description = 'Super-simple testing library for Ruby'
10
10
  spec.summary = [name, version]*'-'
11
11
  spec.homepage = 'https://github.com/sleewoo/' + name
12
12
  spec.license = 'MIT'
@@ -14,13 +14,14 @@ Gem::Specification.new do |spec|
14
14
  spec.files = Dir['**/{*,.[a-z]*}'].reject {|e| e =~ /\.(gem|lock)\Z/}
15
15
  spec.require_paths = ['lib']
16
16
 
17
- spec.executables = Dir['bin/*'].map{|f| File.basename(f)}
17
+ spec.executables = Dir['bin/*'].map{ |f| File.basename(f)}
18
18
 
19
19
  spec.required_ruby_version = '>= 2'
20
20
 
21
21
  spec.add_runtime_dependency 'tty-progressbar', '~> 0.5'
22
22
  spec.add_runtime_dependency 'tty-screen', '~> 0.1'
23
- spec.add_runtime_dependency 'awesome_print', '~> 1.6'
23
+ spec.add_runtime_dependency 'pastel', '~> 0.4'
24
+ spec.add_runtime_dependency 'coderay', '~> 1'
24
25
 
25
26
  spec.add_development_dependency 'minitest', '~> 5.5'
26
27
  spec.add_development_dependency 'bundler', '~> 1.8'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiramisu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Slee Woo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-20 00:00:00.000000000 Z
11
+ date: 2015-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-progressbar
@@ -39,19 +39,33 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.1'
41
41
  - !ruby/object:Gem::Dependency
42
- name: awesome_print
42
+ name: pastel
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.6'
47
+ version: '0.4'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.6'
54
+ version: '0.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coderay
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: minitest
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -94,20 +108,53 @@ dependencies:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
110
  version: '10.4'
97
- description: tiramisu
111
+ description: Super-simple testing library for Ruby
98
112
  email:
99
113
  - mail@sleewoo.com
100
- executables: []
114
+ executables:
115
+ - tiramisu
101
116
  extensions: []
102
117
  extra_rdoc_files: []
103
118
  files:
104
119
  - ".gitignore"
120
+ - ".travis.yml"
105
121
  - Gemfile
106
122
  - LICENSE.txt
107
123
  - README.md
124
+ - README.md.html
108
125
  - Rakefile
126
+ - bin/tiramisu
109
127
  - lib/tiramisu.rb
110
- - lib/tiramisu/version.rb
128
+ - lib/tiramisu/assert.rb
129
+ - lib/tiramisu/core_ext.rb
130
+ - lib/tiramisu/mock.rb
131
+ - lib/tiramisu/mock/expectation.rb
132
+ - lib/tiramisu/mock/expectation/raise.rb
133
+ - lib/tiramisu/mock/expectation/return.rb
134
+ - lib/tiramisu/mock/expectation/throw.rb
135
+ - lib/tiramisu/mock/expectation/with.rb
136
+ - lib/tiramisu/pretty_print.rb
137
+ - lib/tiramisu/run.rb
138
+ - lib/tiramisu/unit.rb
139
+ - lib/tiramisu/util.rb
140
+ - lib/tiramisu/util/assert_raise.rb
141
+ - lib/tiramisu/util/assert_throw.rb
142
+ - lib/tiramisu/util/refute_raise.rb
143
+ - lib/tiramisu/util/refute_throw.rb
144
+ - test/assert_test.rb
145
+ - test/context_inheritance_test.rb
146
+ - test/hooks_test.rb
147
+ - test/raise_test.rb
148
+ - test/receive_and_raise_test.rb
149
+ - test/receive_and_return_test.rb
150
+ - test/receive_and_throw_test.rb
151
+ - test/receive_test.rb
152
+ - test/receive_with_test.rb
153
+ - test/refute_raise_test.rb
154
+ - test/refute_throw_test.rb
155
+ - test/setup.rb
156
+ - test/skip_test.rb
157
+ - test/throw_test.rb
111
158
  - tiramisu.gemspec
112
159
  homepage: https://github.com/sleewoo/tiramisu
113
160
  licenses:
@@ -129,9 +176,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
176
  version: '0'
130
177
  requirements: []
131
178
  rubyforge_project:
132
- rubygems_version: 2.2.2
179
+ rubygems_version: 2.4.5
133
180
  signing_key:
134
181
  specification_version: 4
135
- summary: tiramisu-0.0.0
182
+ summary: tiramisu-0.0.1
136
183
  test_files: []
137
- has_rdoc:
@@ -1,3 +0,0 @@
1
- module Tiramisu
2
- VERSION = "0.0.1"
3
- end