muack 0.7.2 → 0.7.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 +4 -4
- data/.gitignore +1 -1
- data/CHANGES.md +5 -0
- data/README.md +5 -0
- data/Rakefile +6 -15
- data/lib/muack.rb +4 -0
- data/lib/muack/satisfy.rb +7 -0
- data/lib/muack/version.rb +1 -1
- data/muack.gemspec +4 -3
- data/task/gemgem.rb +150 -154
- data/test/test_satisfy.rb +31 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f70136437354cf553340e7a4502e6fc4056802e
|
4
|
+
data.tar.gz: 4f73fe1b681f0e6b4b837f89e72865a008f721af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 832585b3ec72cf71fdd5fd1a607034ddd999e509d03e8239037fc2bb7a3a9d1637996a09ec2e1d2d45ace2539d3b8d4ee5c6877df02ed3a0113e3e2f125d8869
|
7
|
+
data.tar.gz: c9c64a40ec5c10d2cbdf30d17c3952b857915160f7599f8a2258db88ad53d668d75c5f493399d0f315c811d9164ab41267498b329fa2bf8202f2f0dcfe93893f
|
data/.gitignore
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
pkg
|
1
|
+
/pkg/
|
2
2
|
*.rbc
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# CHANGES
|
2
2
|
|
3
|
+
## Muack 0.7.3 -- 2013-10-01
|
4
|
+
|
5
|
+
* Added `Muack::API.including(element)` for detecting if the underlying
|
6
|
+
element is included in the passed argument.
|
7
|
+
|
3
8
|
## Muack 0.7.2 -- 2013-08-23
|
4
9
|
|
5
10
|
* Show correct Expected error for special satisfiers. Previously, it would
|
data/README.md
CHANGED
@@ -18,6 +18,11 @@ It's 32x times faster (750s vs 23s) for running [Rib][] tests.
|
|
18
18
|
[RR]: https://github.com/rr/rr
|
19
19
|
[Rib]: https://github.com/godfat/rib
|
20
20
|
|
21
|
+
## WHY?
|
22
|
+
|
23
|
+
Because RR has/had some bugs and it is too complex for me to fix it.
|
24
|
+
Muack is much simpler and thus much faster and less likely to have bugs.
|
25
|
+
|
21
26
|
## REQUIREMENTS:
|
22
27
|
|
23
28
|
* Tested with MRI (official CRuby) 1.9.3, 2.0.0, Rubinius and JRuby.
|
data/Rakefile
CHANGED
@@ -3,21 +3,12 @@ begin
|
|
3
3
|
require "#{dir = File.dirname(__FILE__)}/task/gemgem"
|
4
4
|
rescue LoadError
|
5
5
|
sh 'git submodule update --init'
|
6
|
-
exec Gem.ruby, '-S',
|
6
|
+
exec Gem.ruby, '-S', $PROGRAM_NAME, *ARGV
|
7
7
|
end
|
8
8
|
|
9
|
-
Gemgem.dir
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
Gemgem.spec = Gemgem.create do |s|
|
15
|
-
require 'muack/version'
|
16
|
-
s.name = 'muack'
|
17
|
-
s.version = Muack::VERSION
|
18
|
-
|
19
|
-
%w[].each{ |g| s.add_runtime_dependency(g) }
|
20
|
-
end
|
21
|
-
|
22
|
-
Gemgem.write
|
9
|
+
Gemgem.init(dir) do |s|
|
10
|
+
require 'muack/version'
|
11
|
+
s.name = 'muack'
|
12
|
+
s.version = Muack::VERSION
|
13
|
+
%w[].each{ |g| s.add_runtime_dependency(g) }
|
23
14
|
end
|
data/lib/muack.rb
CHANGED
data/lib/muack/satisfy.rb
CHANGED
@@ -70,6 +70,13 @@ module Muack
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
+
class Including < Satisfy
|
74
|
+
def initialize element
|
75
|
+
super lambda{ |actual_arg|
|
76
|
+
actual_arg.include?(element) }, [element]
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
73
80
|
class Within < Satisfy
|
74
81
|
def initialize range_or_array
|
75
82
|
super lambda{ |actual_arg| range_or_array.include?(actual_arg) },
|
data/lib/muack/version.rb
CHANGED
data/muack.gemspec
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
# stub: muack 0.7.3 ruby lib
|
2
3
|
|
3
4
|
Gem::Specification.new do |s|
|
4
5
|
s.name = "muack"
|
5
|
-
s.version = "0.7.
|
6
|
+
s.version = "0.7.3"
|
6
7
|
|
7
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
9
|
s.authors = ["Lin Jen-Shin (godfat)"]
|
9
|
-
s.date = "2013-
|
10
|
+
s.date = "2013-10-01"
|
10
11
|
s.description = "Muack -- Yet another mocking library.\n\nBasically it's an [RR][] clone, but much faster under heavy use.\nIt's 32x times faster (750s vs 23s) for running [Rib][] tests.\n\n[RR]: https://github.com/rr/rr\n[Rib]: https://github.com/godfat/rib"
|
11
12
|
s.email = ["godfat (XD) godfat.org"]
|
12
13
|
s.files = [
|
@@ -43,7 +44,7 @@ Gem::Specification.new do |s|
|
|
43
44
|
s.homepage = "https://github.com/godfat/muack"
|
44
45
|
s.licenses = ["Apache License 2.0"]
|
45
46
|
s.require_paths = ["lib"]
|
46
|
-
s.rubygems_version = "2.
|
47
|
+
s.rubygems_version = "2.1.5"
|
47
48
|
s.summary = "Muack -- Yet another mocking library."
|
48
49
|
s.test_files = [
|
49
50
|
"test/test_any_instance_of.rb",
|
data/task/gemgem.rb
CHANGED
@@ -1,14 +1,26 @@
|
|
1
1
|
|
2
|
-
require 'pathname'
|
3
|
-
|
4
2
|
module Gemgem
|
5
3
|
class << self
|
6
|
-
attr_accessor :dir, :spec
|
4
|
+
attr_accessor :dir, :spec, :spec_create
|
7
5
|
end
|
8
6
|
|
9
7
|
module_function
|
8
|
+
def gem_tag ; "#{spec.name}-#{spec.version}" ; end
|
9
|
+
def gem_path ; "#{pkg_dir}/#{gem_tag}.gem" ; end
|
10
|
+
def spec_path ; "#{dir}/#{spec.name}.gemspec" ; end
|
11
|
+
def pkg_dir ; "#{dir}/pkg" ; end
|
12
|
+
def escaped_dir; @escaped_dir ||= Regexp.escape(dir); end
|
13
|
+
|
14
|
+
def init dir, &block
|
15
|
+
self.dir = dir
|
16
|
+
$LOAD_PATH.unshift("#{dir}/lib")
|
17
|
+
ENV['RUBYLIB'] = "#{dir}/lib:#{ENV['RUBYLIB']}"
|
18
|
+
ENV['PATH'] = "#{dir}/bin:#{ENV['PATH']}"
|
19
|
+
self.spec_create = block
|
20
|
+
end
|
21
|
+
|
10
22
|
def create
|
11
|
-
|
23
|
+
spec = Gem::Specification.new do |s|
|
12
24
|
s.authors = ['Lin Jen-Shin (godfat)']
|
13
25
|
s.email = ['godfat (XD) godfat.org']
|
14
26
|
|
@@ -16,163 +28,146 @@ module Gemgem
|
|
16
28
|
s.summary = description.first
|
17
29
|
s.license = readme['LICENSE'].sub(/.+\n\n/, '').lines.first.strip
|
18
30
|
|
19
|
-
s.
|
20
|
-
s.
|
21
|
-
s.
|
22
|
-
s.
|
23
|
-
|
24
|
-
|
25
|
-
}
|
26
|
-
spec
|
27
|
-
spec
|
31
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
32
|
+
s.files = gem_files
|
33
|
+
s.test_files = test_files
|
34
|
+
s.executables = bin_files
|
35
|
+
end
|
36
|
+
spec_create.call(spec)
|
37
|
+
spec.homepage = "https://github.com/godfat/#{spec.name}"
|
38
|
+
self.spec = spec
|
28
39
|
end
|
29
40
|
|
30
|
-
def
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
ps.inject('HEADER' => ps.first){ |r, s, i|
|
39
|
-
r[s[/\w+/]] = s
|
40
|
-
r
|
41
|
-
}
|
41
|
+
def write
|
42
|
+
File.open(spec_path, 'w'){ |f| f << split_lines(spec.to_ruby) }
|
43
|
+
end
|
44
|
+
|
45
|
+
def split_lines ruby
|
46
|
+
ruby.gsub(/(.+?)\s*=\s*\[(.+?)\]/){ |s|
|
47
|
+
if $2.index(',')
|
48
|
+
"#{$1} = [\n #{$2.split(',').map(&:strip).join(",\n ")}]"
|
42
49
|
else
|
43
|
-
|
50
|
+
s
|
44
51
|
end
|
52
|
+
}
|
45
53
|
end
|
46
54
|
|
47
|
-
def
|
48
|
-
|
55
|
+
def strip_path path
|
56
|
+
strip_home_path(strip_cwd_path(path))
|
49
57
|
end
|
50
58
|
|
51
|
-
def
|
52
|
-
path
|
53
|
-
File.exist?("#{Gemgem.dir}/#{name}")
|
54
|
-
}
|
55
|
-
@changes ||=
|
56
|
-
if path
|
57
|
-
date = '\d+{4}\-\d+{2}\-\d{2}'
|
58
|
-
File.read(path).match(
|
59
|
-
/([^\n]+#{date}\n\n(.+?))(?=\n\n[^\n]+#{date}\n|\Z)/m)[1]
|
60
|
-
else
|
61
|
-
''
|
62
|
-
end
|
59
|
+
def strip_home_path path
|
60
|
+
path.sub(ENV['HOME'], '~')
|
63
61
|
end
|
64
62
|
|
65
|
-
def
|
66
|
-
|
67
|
-
"##{readme['DESCRIPTION'][/[^\n]+\n\n[^\n]+/]}\n\n" \
|
68
|
-
"### CHANGES:\n\n" \
|
69
|
-
"###{changes}\n\n" \
|
70
|
-
"##{readme['INSTALLATION']}\n\n" +
|
71
|
-
if readme['SYNOPSIS'] then "##{readme['SYNOPSIS'][/[^\n]+\n\n[^\n]+/]}"
|
72
|
-
else '' end
|
63
|
+
def strip_cwd_path path
|
64
|
+
path.sub(Dir.pwd, '.')
|
73
65
|
end
|
74
66
|
|
75
|
-
def
|
76
|
-
|
77
|
-
gem 'kramdown'
|
78
|
-
|
79
|
-
IO.popen('kramdown', 'r+') do |md|
|
80
|
-
md.puts Gemgem.ann_md
|
81
|
-
md.close_write
|
82
|
-
require 'nokogiri'
|
83
|
-
html = Nokogiri::XML.parse("<gemgem>#{md.read}</gemgem>")
|
84
|
-
html.css('*').each{ |n| n.delete('id') }
|
85
|
-
html.root.children.to_html
|
86
|
-
end
|
67
|
+
def git *args
|
68
|
+
`git --git-dir=#{dir}/.git #{args.join(' ')}`
|
87
69
|
end
|
88
70
|
|
89
|
-
def
|
90
|
-
|
91
|
-
"#{readme['DESCRIPTION']}\n\n" \
|
92
|
-
"#{readme['INSTALLATION']}\n\n" +
|
93
|
-
if readme['SYNOPSIS'] then "##{readme['SYNOPSIS']}\n\n" else '' end +
|
94
|
-
"## CHANGES:\n\n" \
|
95
|
-
"##{changes}\n\n"
|
71
|
+
def sh_git *args
|
72
|
+
Rake.sh('git', "--git-dir=#{dir}/.git", *args)
|
96
73
|
end
|
97
74
|
|
98
|
-
def
|
99
|
-
|
75
|
+
def sh_gem *args
|
76
|
+
Rake.sh(Gem.ruby, '-S', 'gem', *args)
|
100
77
|
end
|
101
78
|
|
102
|
-
def
|
103
|
-
|
104
|
-
f << split_lines(spec.to_ruby) }
|
79
|
+
def glob path=dir
|
80
|
+
Dir.glob("#{path}/**/*", File::FNM_DOTMATCH)
|
105
81
|
end
|
106
82
|
|
107
|
-
def
|
108
|
-
|
109
|
-
if
|
110
|
-
|
83
|
+
def readme
|
84
|
+
@readme ||=
|
85
|
+
if (path = "#{Gemgem.dir}/README.md") && File.exist?(path)
|
86
|
+
ps = "##{File.read(path)}".
|
87
|
+
scan(/((#+)[^\n]+\n\n.+?(?=(\n\n\2[^#\n]+\n)|\Z))/m).map(&:first)
|
88
|
+
ps.inject('HEADER' => ps.first){ |r, s, i|
|
89
|
+
r[s[/\w+/]] = s
|
90
|
+
r
|
91
|
+
}
|
111
92
|
else
|
112
|
-
|
93
|
+
{}
|
113
94
|
end
|
114
|
-
|
95
|
+
end
|
96
|
+
|
97
|
+
def description
|
98
|
+
# JRuby String#lines is returning an enumerator
|
99
|
+
@description ||= (readme['DESCRIPTION']||'').sub(/.+\n\n/, '').lines.to_a
|
115
100
|
end
|
116
101
|
|
117
102
|
def all_files
|
118
|
-
@all_files ||=
|
119
|
-
|
120
|
-
|
103
|
+
@all_files ||= fold_files(glob).sort
|
104
|
+
end
|
105
|
+
|
106
|
+
def fold_files files
|
107
|
+
files.inject([]){ |r, path|
|
108
|
+
if File.file?(path) && path !~ %r{/\.git(/|$)} &&
|
109
|
+
(rpath = path[%r{^#{escaped_dir}/(.*$)}, 1])
|
110
|
+
r << rpath
|
111
|
+
elsif File.symlink?(path) # walk into symlinks...
|
112
|
+
r.concat(fold_files(glob(File.expand_path(path,
|
113
|
+
File.readlink(path)))))
|
121
114
|
else
|
122
|
-
|
115
|
+
r
|
123
116
|
end
|
124
|
-
}
|
117
|
+
}
|
125
118
|
end
|
126
119
|
|
127
120
|
def gem_files
|
128
|
-
@gem_files ||= all_files
|
121
|
+
@gem_files ||= all_files.reject{ |f|
|
122
|
+
f =~ ignored_pattern && !git_files.include?(f)
|
123
|
+
}
|
129
124
|
end
|
130
125
|
|
131
|
-
def
|
132
|
-
@
|
133
|
-
|
126
|
+
def test_files
|
127
|
+
@test_files ||= gem_files.grep(%r{^test/(.+?/)*test_.+?\.rb$})
|
128
|
+
end
|
129
|
+
|
130
|
+
def bin_files
|
131
|
+
@bin_files ||= gem_files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
134
132
|
end
|
135
133
|
|
136
134
|
def git_files
|
137
135
|
@git_files ||= if File.exist?("#{dir}/.git")
|
138
|
-
|
136
|
+
git('ls-files').split("\n")
|
139
137
|
else
|
140
138
|
[]
|
141
139
|
end
|
142
140
|
end
|
143
141
|
|
144
|
-
|
145
|
-
|
146
|
-
path.children.select(&:file?).map{|file| file.to_s[(dir.size+1)..-1]} +
|
147
|
-
path.children.select(&:directory?).map{|dir| find_files(dir)}.flatten
|
142
|
+
def ignored_files
|
143
|
+
@ignored_files ||= all_files.grep(ignored_pattern)
|
148
144
|
end
|
149
145
|
|
150
|
-
def
|
151
|
-
@
|
152
|
-
gitignore.split("\n").reject{ |pattern|
|
153
|
-
pattern.strip == ''
|
154
|
-
}).map{ |pattern| %r{^([^/]+/)*?#{Regexp.escape(pattern)}(/[^/]+)*?$} }
|
146
|
+
def ignored_pattern
|
147
|
+
@ignored_pattern ||= Regexp.new(expand_patterns(gitignore).join('|'))
|
155
148
|
end
|
156
149
|
|
157
150
|
def expand_patterns pathes
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
151
|
+
# http://git-scm.com/docs/gitignore
|
152
|
+
pathes.flat_map{ |path|
|
153
|
+
case path
|
154
|
+
when %r{\*}
|
155
|
+
Regexp.escape(path).gsub(/\\\*/, '[^/]*')
|
156
|
+
when %r{^/}
|
157
|
+
"^#{Regexp.escape(path[1..-1])}"
|
158
|
+
else # we didn't implement negative pattern for now
|
159
|
+
Regexp.escape(path)
|
166
160
|
end
|
167
|
-
}
|
161
|
+
}
|
168
162
|
end
|
169
163
|
|
170
164
|
def gitignore
|
171
|
-
if File.exist?(path = "#{dir}/.gitignore")
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
165
|
+
@gitignore ||= if File.exist?(path = "#{dir}/.gitignore")
|
166
|
+
File.read(path).lines.
|
167
|
+
reject{ |l| l == /^\s*(#|\s+$)/ }.map(&:strip)
|
168
|
+
else
|
169
|
+
[]
|
170
|
+
end
|
176
171
|
end
|
177
172
|
end
|
178
173
|
|
@@ -180,22 +175,37 @@ namespace :gem do
|
|
180
175
|
|
181
176
|
desc 'Install gem'
|
182
177
|
task :install => [:build] do
|
183
|
-
|
178
|
+
Gemgem.sh_gem('install', Gemgem.gem_path)
|
184
179
|
end
|
185
180
|
|
186
181
|
desc 'Build gem'
|
187
182
|
task :build => [:spec] do
|
188
|
-
|
189
|
-
|
190
|
-
|
183
|
+
require 'fileutils'
|
184
|
+
require 'rubygems/package'
|
185
|
+
gem = nil
|
186
|
+
Dir.chdir(Gemgem.dir) do
|
187
|
+
gem = Gem::Package.build(Gem::Specification.load(Gemgem.spec_path))
|
188
|
+
FileUtils.mkdir_p(Gemgem.pkg_dir)
|
189
|
+
FileUtils.mv(gem, Gemgem.pkg_dir) # gem is relative path, but might be ok
|
190
|
+
end
|
191
|
+
puts "\e[35mGem built: \e[33m" \
|
192
|
+
"#{Gemgem.strip_path("#{Gemgem.pkg_dir}/#{gem}")}\e[0m"
|
193
|
+
end
|
194
|
+
|
195
|
+
desc 'Generate gemspec'
|
196
|
+
task :spec do
|
197
|
+
Gemgem.create
|
198
|
+
Gemgem.write
|
191
199
|
end
|
192
200
|
|
193
201
|
desc 'Release gem'
|
194
202
|
task :release => [:spec, :check, :build] do
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
203
|
+
Gemgem.module_eval do
|
204
|
+
sh_git('tag', Gemgem.gem_tag)
|
205
|
+
sh_git('push')
|
206
|
+
sh_git('push', '--tags')
|
207
|
+
sh_gem('push', Gemgem.gem_path)
|
208
|
+
end
|
199
209
|
end
|
200
210
|
|
201
211
|
task :check do
|
@@ -218,51 +228,37 @@ end # of gem namespace
|
|
218
228
|
|
219
229
|
desc 'Run tests in memory'
|
220
230
|
task :test do
|
231
|
+
next if Gemgem.test_files.empty?
|
232
|
+
|
221
233
|
require 'bacon'
|
222
234
|
Bacon.extend(Bacon::TestUnitOutput)
|
223
235
|
Bacon.summary_on_exit
|
224
|
-
|
225
|
-
Dir['./test/**/test_*.rb'].each{ |file| require file[0..-4] }
|
226
|
-
end
|
227
|
-
|
228
|
-
desc 'Run tests with shell'
|
229
|
-
task 'test:shell', :RUBY_OPTS do |t, args|
|
230
|
-
files = Dir['test/**/test_*.rb'].join(' ')
|
231
|
-
|
232
|
-
cmd = [Gem.ruby, args[:RUBY_OPTS],
|
233
|
-
'-I', 'lib', '-S', 'bacon', '--quiet', files]
|
234
|
-
|
235
|
-
sh(cmd.compact.join(' '))
|
236
|
+
Gemgem.test_files.each{ |file| require "#{Gemgem.dir}/#{file[0..-4]}" }
|
236
237
|
end
|
237
238
|
|
238
|
-
desc '
|
239
|
-
task
|
240
|
-
|
241
|
-
end
|
239
|
+
desc 'Remove ignored files'
|
240
|
+
task :clean => ['gem:spec'] do
|
241
|
+
next if Gemgem.ignored_files.empty?
|
242
242
|
|
243
|
-
|
244
|
-
|
245
|
-
puts
|
246
|
-
|
243
|
+
require 'fileutils'
|
244
|
+
trash = File.expand_path("~/.Trash/#{Gemgem.spec.name}")
|
245
|
+
puts "Move the following files into:" \
|
246
|
+
" \e[35m#{Gemgem.strip_path(trash)}\e[33m"
|
247
247
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
248
|
+
Gemgem.ignored_files.each do |file|
|
249
|
+
from = "#{Gemgem.dir}/#{file}"
|
250
|
+
to = "#{trash}/#{File.dirname(file)}"
|
251
|
+
puts Gemgem.strip_path(from)
|
252
252
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
" --files #{Gemgem.spec.extra_rdoc_files.join(',')}")
|
257
|
-
end
|
253
|
+
FileUtils.mkdir_p(to)
|
254
|
+
FileUtils.mv(from, to)
|
255
|
+
end
|
258
256
|
|
259
|
-
|
260
|
-
task :clean => ['gem:spec'] do
|
261
|
-
trash = "~/.Trash/#{Gemgem.spec.name}/"
|
262
|
-
sh "mkdir -p #{trash}" unless File.exist?(File.expand_path(trash))
|
263
|
-
Gemgem.ignored_files.each{ |file| sh "mv #{file} #{trash}" }
|
257
|
+
print "\e[0m"
|
264
258
|
end
|
265
259
|
|
266
260
|
task :default do
|
267
|
-
|
261
|
+
# Is there a reliable way to do this in the current process?
|
262
|
+
# It failed miserably before between Rake versions...
|
263
|
+
exec "#{Gem.ruby} -S #{$PROGRAM_NAME} -f #{Rake.application.rakefile} -T"
|
268
264
|
end
|
data/test/test_satisfy.rb
CHANGED
@@ -131,6 +131,37 @@ describe Muack::Satisfy do
|
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
+
describe Muack::Including do
|
135
|
+
should 'have human readable to_s and inspect' do
|
136
|
+
matcher = including(2)
|
137
|
+
expected = 'Muack::API.including(2)'
|
138
|
+
matcher.to_s .should.eq expected
|
139
|
+
matcher.inspect.should.eq expected
|
140
|
+
end
|
141
|
+
|
142
|
+
should 'satisfy' do
|
143
|
+
mock(Str).say(including(2)){ |arg| arg.first }
|
144
|
+
Str.say([1, 2]).should.eq 1
|
145
|
+
Muack.verify.should.eq true
|
146
|
+
Muack::EnsureReset.call
|
147
|
+
end
|
148
|
+
|
149
|
+
should 'raise Unexpected error if passing unexpected argument' do
|
150
|
+
mock(Obj).say(including(2)){ 'boo' }
|
151
|
+
begin
|
152
|
+
Obj.say([1])
|
153
|
+
'never'.should.eq 'reach'
|
154
|
+
rescue Muack::Unexpected => e
|
155
|
+
e.expected.should.eq 'obj.say(Muack::API.including(2))'
|
156
|
+
e.was .should.eq 'obj.say([1])'
|
157
|
+
e.message .should.eq "\nExpected: #{e.expected}\n but was: #{e.was}"
|
158
|
+
ensure
|
159
|
+
Muack.reset
|
160
|
+
Muack::EnsureReset.call
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
134
165
|
describe Muack::Within do
|
135
166
|
should 'have human readable to_s and inspect' do
|
136
167
|
matcher = within(0..9)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lin Jen-Shin (godfat)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Muack -- Yet another mocking library.
|
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
version: '0'
|
75
75
|
requirements: []
|
76
76
|
rubyforge_project:
|
77
|
-
rubygems_version: 2.
|
77
|
+
rubygems_version: 2.1.5
|
78
78
|
signing_key:
|
79
79
|
specification_version: 4
|
80
80
|
summary: Muack -- Yet another mocking library.
|