minitest-english 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZjQxNTA3MTk3ZDE3NjM0MDU0Njk0MDExOTJjYjJhOWQyODJiNmY2Nw==
5
+ data.tar.gz: !binary |-
6
+ ZWVjMGMwOTIyNjI4MWE0NDQxMjRmZjE0ZWE0NzUzMjRjYmVjZGQzZg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ Mjg0NTYyNWJhNzljNTZkYjZiOTFhZjE1N2VlZmViMzI5OTQxOWI4YTU1YTk5
10
+ YjRmMjE5Y2NhNTZmMGUzNmU4ZDI2NzFkMTZmZjBlYTVmM2JiOTFmZjNjZDI1
11
+ MmVkMjlhZmFhMTEyYzdiNmE5YzdiYTdkMzk5Y2M1YmIzN2Q4ZTY=
12
+ data.tar.gz: !binary |-
13
+ ZGEwZTA4NzY4M2ZkZTQ1ZDk1MjE4YmY5ODcyYzZlNmI4YWMyMjk5OGY4YjM2
14
+ NmI3ZDM0NzA3MGM0NWQ2N2I0Y2MwYzUxODM3YWI4MWY4YTNkMGMyOWZmNWMw
15
+ ZTMxN2U2NDRjZGE3OGViMzc1ZDJhYTAxYWNmMzFlNjA5ODhkZWM=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p392
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in minitest-english.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Dom Kiva-Meyer
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # minitest-english
2
+
3
+ MiniTest is an awesome testing framework. It's small, fast, and has very little magic.
4
+
5
+ > There are two hard things in Computer Science: cache invalidation and naming things.
6
+ > — Phil Karlton
7
+
8
+ Unfortunately, MiniTest fails at the latter.
9
+
10
+ ![Pulp Fiction](pulp_fiction.gif)
11
+
12
+ ## What?
13
+
14
+ `minitest-english` augments MiniTest's assertion and expectation naming with semantically symmetric aliases.
15
+
16
+ ## Why?
17
+
18
+ ### Assertions
19
+
20
+ MiniTest provides a variety of positive and negative assertions:
21
+
22
+ ```ruby
23
+ assert_equals true, true
24
+ refute_equals true, false
25
+ assert_nil nil
26
+ refute_nil true
27
+ # etc.
28
+ ```
29
+
30
+ __"Refute" is not an antonym of "assert." Refutation requires proof, not just assertion.__
31
+
32
+ ### Expectations
33
+
34
+ Every assertion has an aliased expectation:
35
+
36
+ ```ruby
37
+ true.must_equal true
38
+ true.wont_equal false
39
+ nil.must_be_nil
40
+ true.wont_be_nil
41
+ # etc.
42
+ ```
43
+
44
+ __"Must" is present tense but "wont" (contraction of "will not") is future tense.__
45
+
46
+ ## How?
47
+
48
+ `minitest-english` aliases all `refute` assertions with `deny` assertions and all `wont` expectations with `must_not` expectations.
49
+
50
+ It's simple and does not use `method_missing` or any other inefficient techniques.
51
+
52
+ _You know it's a tiny gem when you spend longer writing the readme than the code._
53
+
54
+
55
+ ## Installation
56
+
57
+ Add this line to your application's Gemfile:
58
+
59
+ gem 'minitest-english'
60
+
61
+ And then execute:
62
+
63
+ $ bundle install
64
+
65
+ Require it in your test_helper or spec_helper:
66
+
67
+ require 'minitest/english'
68
+
69
+ ## Usage
70
+
71
+ Write your negative assertions with `deny`.
72
+ ```ruby
73
+ refute_equal "English", "Do you speak it?"
74
+ # refute* becomes deny*
75
+ deny_equal "English", "Do you speak it?"
76
+ ```
77
+
78
+ Write your negative expectations with `must_not`.
79
+ ```ruby
80
+ "Do you speak it?".wont_equal "English"
81
+ # wont* becomes must_not*
82
+ "Do you speak it?".must_not_equal "English"
83
+ ```
84
+
85
+ ## Caveat
86
+
87
+ Perhaps you prefer geometric equality to semantic equality.
88
+
89
+ ```ruby
90
+ "assert".length == "refute".length
91
+ "must".length == "wont".length
92
+ ```
93
+
94
+ If so, use `minitest-english` anyway and make your middle school English teacher proud.
95
+
96
+
97
+ ## Contributing
98
+
99
+ 1. Fork it
100
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
101
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
102
+ 4. Push to the branch (`git push origin my-new-feature`)
103
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs = %w[lib test]
6
+ t.test_files = FileList['test/**/*_test.rb']
7
+ end
8
+
9
+ task(default: :test)
@@ -0,0 +1 @@
1
+ require 'minitest/english'
@@ -0,0 +1,2 @@
1
+ require 'minitest/english/assertions'
2
+ require 'minitest/english/expectations'
@@ -0,0 +1,8 @@
1
+ require 'minitest/unit'
2
+
3
+ module MiniTest::Assertions
4
+ instance_methods.each do |method|
5
+ next unless match = /^refute(.*)/.match(method)
6
+ alias_method "deny#{match[1]}", method
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'minitest/spec'
2
+
3
+ module MiniTest::Expectations
4
+ instance_methods.each do |method|
5
+ next unless match = /^wont(.*)/.match(method)
6
+ alias_method "must_not#{match[1]}", method
7
+ end
8
+ end
@@ -0,0 +1,18 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = 'minitest-english'
5
+ gem.version = '0.0.1'
6
+ gem.author = 'Dom Kiva-Meyer'
7
+ gem.summary = 'Minitest + the English language'
8
+ gem.homepage = 'http://github.com/domkm/minitest-english'
9
+ gem.license = 'MIT'
10
+
11
+ gem.files = `git ls-files`.split($/)
12
+ gem.test_files = gem.files.grep(%r{^(test|spec)/})
13
+
14
+ gem.add_development_dependency 'bundler', '~> 1.3'
15
+ gem.add_development_dependency 'm'
16
+ gem.add_development_dependency 'minitest'
17
+ gem.add_development_dependency 'rake'
18
+ end
data/pulp_fiction.gif ADDED
Binary file
@@ -0,0 +1,11 @@
1
+ require 'test_helper'
2
+
3
+ describe MiniTest::Assertions do
4
+ MiniTest::Assertions.instance_methods.each do |method|
5
+ next unless match = /^refute(.*)/.match(method)
6
+ it "aliases #{method} to deny#{match[1]}" do
7
+ assert_equal MiniTest::Assertions.instance_method(method),
8
+ MiniTest::Assertions.instance_method("deny#{match[1]}")
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'test_helper'
2
+
3
+ describe MiniTest::Expectations do
4
+ MiniTest::Expectations.instance_methods.each do |method|
5
+ next unless match = /^wont(.*)/.match(method)
6
+ it "aliases #{method} to must_not#{match[1]}" do
7
+ assert_equal MiniTest::Expectations.instance_method(method),
8
+ MiniTest::Expectations.instance_method("must_not#{match[1]}")
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/english'
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minitest-english
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Dom Kiva-Meyer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-04-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: m
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
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
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description:
70
+ email:
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - .gitignore
76
+ - .ruby-version
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - lib/minitest-english.rb
82
+ - lib/minitest/english.rb
83
+ - lib/minitest/english/assertions.rb
84
+ - lib/minitest/english/expectations.rb
85
+ - minitest-english.gemspec
86
+ - pulp_fiction.gif
87
+ - test/assertions_test.rb
88
+ - test/expectations_test.rb
89
+ - test/test_helper.rb
90
+ homepage: http://github.com/domkm/minitest-english
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.0.3
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Minitest + the English language
114
+ test_files:
115
+ - test/assertions_test.rb
116
+ - test/expectations_test.rb
117
+ - test/test_helper.rb