minitest-global_expectations 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: af8cd0e6d424e9a1a7409c63cecd155b0c68d52bd5eccbce61df60cfcca3e5b4
4
+ data.tar.gz: 73982107a7c0ebcd3d055425dd5a0b9def9e7d6290a2ebf14a00b42317f87cad
5
+ SHA512:
6
+ metadata.gz: 93bf6e4b3478beab1a1139e16785881e220b16d946775c450c88fe68186fd58c08968a3f8c200e83b785751d56c95ea1a3aea92280799a16beb685eb3e46aab0
7
+ data.tar.gz: 47e0ac264c086075711a46103979389abd47d3dea6c4a8ef18466b5bfbc2bde28c39b130193867c3fe90c6843e0b74205e00b4be6d509111be5c238ee7871cf5
@@ -0,0 +1,3 @@
1
+ === 1.0.0 (2019-09-24)
2
+
3
+ * Initial Public Release
@@ -0,0 +1,18 @@
1
+ Copyright (c) 2019 Jeremy Evans
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,40 @@
1
+ = minitest-global_expectations
2
+
3
+ minitest-global_expectations allows you to keep using simple code in your
4
+ minitest specs, without having to wrap every single object you are calling
5
+ an expectation method on with <tt>_</tt>:
6
+
7
+ # You can use:
8
+ foo.must_equal 1
9
+
10
+ # instead of:
11
+ _(foo).must_equal 1
12
+
13
+ Calling expectation methods on all objects was supported in Minitest <5.12,
14
+ was deprecated in Minitest 5.12, and is planned to be removed from Minitest 6.
15
+
16
+ = Installation
17
+
18
+ gem install minitest-global_expectations
19
+
20
+ = Source Code
21
+
22
+ Source code is available on GitHub at https://github.com/jeremyevans/minitest-global_expectations
23
+
24
+ = Usage
25
+
26
+ Just require the library. You can switch requires of +minitest/spec+ to:
27
+
28
+ require 'minitest/global_expectations'
29
+
30
+ Alternatively, if you are requiring +minitest/autorun+, you can switch to:
31
+
32
+ require 'minitest/global_expectations/autorun'
33
+
34
+ = License
35
+
36
+ MIT
37
+
38
+ = Author
39
+
40
+ Jeremy Evans <code@jeremyevans.net>
@@ -0,0 +1,18 @@
1
+ require "rake"
2
+ require "rake/clean"
3
+
4
+ CLEAN.include ["minitest-global_expectations-*.gem"]
5
+
6
+ desc "Build minitest-global_expectations gem"
7
+ task :package=>[:clean] do |p|
8
+ sh %{#{FileUtils::RUBY} -S gem build minitest-global_expectations.gemspec}
9
+ end
10
+
11
+ ### Specs
12
+
13
+ desc "Run test"
14
+ task :test do
15
+ sh %{#{FileUtils::RUBY} test/minitest_global_expectations_test.rb}
16
+ end
17
+
18
+ task :default=>:test
@@ -0,0 +1,42 @@
1
+ require 'minitest/spec'
2
+
3
+ module MinitestGlobalExpectations
4
+ [
5
+ :must_be_empty,
6
+ :must_equal,
7
+ :must_be_close_to,
8
+ :must_be_within_epsilon,
9
+ :must_include,
10
+ :must_be_instance_of,
11
+ :must_be_kind_of,
12
+ :must_match,
13
+ :must_be_nil,
14
+ :must_be,
15
+ :must_output,
16
+ :must_raise,
17
+ :must_respond_to,
18
+ :must_be_same_as,
19
+ :must_be_silent,
20
+ :must_throw,
21
+ :wont_be_empty,
22
+ :wont_equal,
23
+ :wont_be_close_to,
24
+ :wont_be_within_epsilon,
25
+ :wont_include,
26
+ :wont_be_instance_of,
27
+ :wont_be_kind_of,
28
+ :wont_match,
29
+ :wont_be_nil,
30
+ :wont_be,
31
+ :wont_respond_to,
32
+ :wont_be_same_as,
33
+ ].each do |meth|
34
+ self.class_eval(<<-EOM, __FILE__, __LINE__ + 1)
35
+ def #{meth}(*args)
36
+ Minitest::Expectation.new(self, Minitest::Spec.current).#{meth}(*args)
37
+ end
38
+ EOM
39
+ end
40
+
41
+ ::Object.send(:include, self)
42
+ end
@@ -0,0 +1,2 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/global_expectations'
@@ -0,0 +1,37 @@
1
+ $:.unshift(File.join(File.dirname(File.expand_path(__FILE__)), "../lib/"))
2
+ require 'rubygems'
3
+ ENV['MT_NO_PLUGINS'] = '1' # Work around stupid autoloading of plugins
4
+ gem 'minitest'
5
+ require 'minitest/global_expectations/autorun'
6
+
7
+ describe "minitest-global_expectations" do
8
+ it "should allow calling expectation methods on all objects" do
9
+ [].must_be_empty
10
+ 1.must_equal 1
11
+ 1.0.must_be_close_to 1.000000001
12
+ 1.0.must_be_within_epsilon 1.000000001
13
+ [1].must_include 1
14
+ Object.new.must_be_instance_of Object
15
+ 1.must_be_kind_of Numeric
16
+ 'a'.must_match(/a/)
17
+ nil.must_be_nil
18
+ 1.must_be :==, 1
19
+ proc{print '.'}.must_output('.')
20
+ proc{raise}.must_raise RuntimeError
21
+ 1.must_respond_to :abs
22
+ true.must_be_same_as true
23
+ proc{}.must_be_silent
24
+ proc{throw :foo}.must_throw :foo
25
+ [1].wont_be_empty
26
+ 1.wont_equal 2
27
+ 1.wont_be_close_to 2
28
+ 1.wont_be_within_epsilon 2
29
+ [1].wont_include 2
30
+ 1.wont_be_instance_of Numeric
31
+ 1.wont_be_kind_of Hash
32
+ 'a'.wont_match(/b/)
33
+ 1.wont_be_nil
34
+ 1.wont_be :==, 2
35
+ 1.wont_respond_to :foo
36
+ end
37
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minitest-global_expectations
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jeremy Evans
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-09-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">"
18
+ - !ruby/object:Gem::Version
19
+ version: '5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">"
25
+ - !ruby/object:Gem::Version
26
+ version: '5'
27
+ description: |
28
+ minitest-global_expectations allows you to keep using simple code in your
29
+ minitest specs, without having to wrap every single object you are calling
30
+ an expectation method on with an underscore.
31
+ email: code@jeremyevans.net
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files:
35
+ - README.rdoc
36
+ - CHANGELOG
37
+ - MIT-LICENSE
38
+ files:
39
+ - CHANGELOG
40
+ - MIT-LICENSE
41
+ - README.rdoc
42
+ - Rakefile
43
+ - lib/minitest/global_expectations.rb
44
+ - lib/minitest/global_expectations/autorun.rb
45
+ - test/minitest_global_expectations_test.rb
46
+ homepage: http://github.com/jeremyevans/minitest-global_expectations
47
+ licenses:
48
+ - MIT
49
+ metadata: {}
50
+ post_install_message:
51
+ rdoc_options:
52
+ - "--quiet"
53
+ - "--line-numbers"
54
+ - "--inline-source"
55
+ - "--title"
56
+ - 'minitest-global_expectations: add expectation methods to all objects'
57
+ - "--main"
58
+ - README.rdoc
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubygems_version: 3.0.3
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: Support minitest expectation methods for all objects
76
+ test_files: []