assert-moar 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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 56f10491f1746292f44e9efa93cab0d9206fd5f5
4
+ data.tar.gz: 1496d33a9b8bd3c53e17ae810b2fce84c4aaa1a5
5
+ SHA512:
6
+ metadata.gz: c40dd34756d0431633baaaa01859318fd102add23a48cffed62f99f3ca3dc1d93b8297bd62eb490b466ee718645c351a5f53203e224ad3beeaf5c435fa4f8da9
7
+ data.tar.gz: e3168443bae2a8070322a5b28d7069e2203047236867fb21fba7a960e32409498badd513f0977d89c8a358f85ee33928d6f97f063451199f03ccf1ebd267b379
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/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ rvm:
2
+ - 1.9.3
3
+ - 2.0.0
4
+ - 2.1.0
5
+ - jruby
6
+ - rbx
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in assert-moar.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,11 @@
1
+ guard 'minitest' do
2
+ # with Minitest::Unit
3
+ watch(%r|^test/(.*)\/(.*)_test\.rb|)
4
+ watch(%r|^lib/(.*)\.rb|) { |m| "test/lib/#{m[1]}_test.rb" }
5
+ watch(%r|^test/test_helper\.rb|) { "test" }
6
+ end
7
+
8
+ guard :bundler do
9
+ watch('Gemfile')
10
+ watch(/^.+\.gemspec/)
11
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 John Bohn
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,37 @@
1
+ # Assert::Moar
2
+
3
+ [![Build Status](https://travis-ci.org/jjbohn/assert-moar.png?branch=master)](https://travis-ci.org/jjbohn/assert-moar)
4
+ [![Coverage Status](https://coveralls.io/repos/jjbohn/assert-moar/badge.png?branch=master)](https://coveralls.io/r/jjbohn/assert-moar?branch=master)
5
+ [![Code Climate](https://codeclimate.com/github/jjbohn/assert-moar.png)](https://codeclimate.com/github/jjbohn/assert-moar)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'assert-moar'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install assert-moar
20
+
21
+ ## Usage
22
+
23
+ Available methods:
24
+ ```
25
+ #assert_valid
26
+ #refute_valid
27
+ #assert_validates_presence_of
28
+ #refute_validates_presence_of
29
+ ```
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it ( http://github.com/jjbohn/assert-moar/fork )
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'lib/assert_moar'
6
+ t.libs << 'lib/minitest'
7
+ t.test_files = FileList['test/lib/assert_moar/**/*_test.rb','test/lib/minitest/**/*_test.rb' ]
8
+ t.verbose = true
9
+ end
10
+
11
+ task default: :test
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'assert_moar/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "assert-moar"
8
+ spec.version = AssertMoar::VERSION
9
+ spec.authors = ["John Bohn"]
10
+ spec.email = ["jjbohn@gmail.com"]
11
+ spec.summary = %q{Extra assertions for minitest}
12
+ spec.description = %q{Extra assertions for minitest}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "minitest"
24
+ spec.add_development_dependency "mocha"
25
+ spec.add_development_dependency "guard"
26
+ spec.add_development_dependency "guard-minitest"
27
+ spec.add_development_dependency "guard-bundler"
28
+ spec.add_development_dependency "simplecov"
29
+ spec.add_development_dependency "pry"
30
+ spec.add_development_dependency "coveralls"
31
+ spec.add_development_dependency "faker"
32
+ end
@@ -0,0 +1,3 @@
1
+ module AssertMoar
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ require 'assert_moar/version'
2
+
3
+ module AssertMoar
4
+ end
@@ -0,0 +1,23 @@
1
+ module MiniTest::Assertions
2
+ def assert_validates_presence_of(object, property)
3
+ assert_valid(object)
4
+ object.send("#{property}=", nil)
5
+ refute object.valid?, "Expected object not to be valid"
6
+ assert object.errors[property.to_sym], "Expected errors to exist for #{property}"
7
+ end
8
+
9
+ def refute_validates_presence_of(object, property)
10
+ assert_valid(object)
11
+ object.send("#{property}=", nil)
12
+ assert_valid(object)
13
+ assert_nil object.errors[property.to_sym]
14
+ end
15
+
16
+ def assert_valid(object)
17
+ assert object.valid?, "Expected object to be valid"
18
+ end
19
+
20
+ def refute_valid(object)
21
+ refute object.valid?, "Expected object to not be valid"
22
+ end
23
+ end
@@ -0,0 +1,7 @@
1
+ require_relative '../../test_helper'
2
+
3
+ class AssertMoar::VersionTest < MiniTest::Test
4
+ def test_version_defined
5
+ refute_nil AssertMoar::VERSION
6
+ end
7
+ end
@@ -0,0 +1,39 @@
1
+ require_relative '../../test_helper'
2
+
3
+ class Minitest::AssertionTest < Minitest::Test
4
+ def setup
5
+ super
6
+
7
+ Minitest::Test.reset
8
+
9
+ @tc = Minitest::Test.new('foo')
10
+ @assertion_count = 1
11
+ end
12
+
13
+ def test_assert_valid
14
+ double = ActiveRecordBaseDouble.new
15
+ double.property = "foo"
16
+ @tc.assert_valid double
17
+ end
18
+
19
+ def test_refute_valid
20
+ @tc.refute_valid ActiveRecordBaseDouble.new
21
+ end
22
+
23
+ def test_assert_validates_presence_of
24
+ @assertion_count = 3
25
+ double = ActiveRecordBaseDouble.new
26
+ double.property = "foo"
27
+ @tc.assert_validates_presence_of(double, :property)
28
+ end
29
+
30
+ def test_refute_validates_presence_of
31
+ @assertion_count = 3
32
+ @tc.refute_validates_presence_of(ActiveRecordBaseDouble.new(false), :property)
33
+ end
34
+
35
+ def teardown
36
+ assert_equal(@assertion_count, @tc.assertions,
37
+ "expected #{@assertion_count} assertions to be fired during the test, not #{@tc.assertions}") if @tc.passed?
38
+ end
39
+ end
@@ -0,0 +1,33 @@
1
+ require 'simplecov'
2
+ SimpleCov.command_name 'test'
3
+ SimpleCov.start
4
+
5
+ require 'coveralls'
6
+ Coveralls.wear!
7
+
8
+ require 'minitest/autorun'
9
+ require 'mocha/mini_test'
10
+ require_relative '../lib/minitest/assertions'
11
+ require_relative '../lib/assert_moar'
12
+
13
+ class ActiveRecordBaseDouble
14
+ attr_accessor :errors, :property
15
+
16
+ def initialize(assert_valid = true)
17
+ @errors = {}
18
+ @assert_valid = assert_valid
19
+ end
20
+
21
+ def property=(value)
22
+ @property = value
23
+ @errors[:property] = value.nil? ? String.new : nil if asserts_valid?
24
+ end
25
+
26
+ def valid?
27
+ !@property.nil? || !asserts_valid?
28
+ end
29
+
30
+ def asserts_valid?
31
+ @assert_valid == true
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,215 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: assert-moar
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - John Bohn
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-24 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.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
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: mocha
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
+ - !ruby/object:Gem::Dependency
70
+ name: guard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard-bundler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: coveralls
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: faker
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ description: Extra assertions for minitest
168
+ email:
169
+ - jjbohn@gmail.com
170
+ executables: []
171
+ extensions: []
172
+ extra_rdoc_files: []
173
+ files:
174
+ - .gitignore
175
+ - .travis.yml
176
+ - Gemfile
177
+ - Guardfile
178
+ - LICENSE.txt
179
+ - README.md
180
+ - Rakefile
181
+ - assert-moar.gemspec
182
+ - lib/assert_moar.rb
183
+ - lib/assert_moar/version.rb
184
+ - lib/minitest/assertions.rb
185
+ - test/lib/assert_moar/version_test.rb
186
+ - test/lib/minitest/assertions_test.rb
187
+ - test/test_helper.rb
188
+ homepage: ''
189
+ licenses:
190
+ - MIT
191
+ metadata: {}
192
+ post_install_message:
193
+ rdoc_options: []
194
+ require_paths:
195
+ - lib
196
+ required_ruby_version: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - '>='
199
+ - !ruby/object:Gem::Version
200
+ version: '0'
201
+ required_rubygems_version: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ requirements: []
207
+ rubyforge_project:
208
+ rubygems_version: 2.0.14
209
+ signing_key:
210
+ specification_version: 4
211
+ summary: Extra assertions for minitest
212
+ test_files:
213
+ - test/lib/assert_moar/version_test.rb
214
+ - test/lib/minitest/assertions_test.rb
215
+ - test/test_helper.rb