fun_with_testing 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
+ MWE5NTczZmFmZGNiM2RlYzVhMjhlYmY5NWViZDZkOWM1M2Y4NjljNg==
5
+ data.tar.gz: !binary |-
6
+ NTZhYmJkMjk5ZWQ2ZjBjYzgwMDM5MDk5NzU1ZGM2Y2Y4YWY5YmI3ZA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZGYxNzU2NjdiNTI2MTRlNjU1NjkxYWQ5NWIwOWFkMzQzODllYTE2OTBhYTFh
10
+ OWY2NzhiZjk3Mjk2YzZhZmI1MzA0MzY3MTQxMzE5ZTgzZGU0ZGYyYjZhYzA1
11
+ M2QzOWFmNDEyN2I0ZWVkNjZhM2E0NzBlNTBiMWRmN2Q4NjY2ZTI=
12
+ data.tar.gz: !binary |-
13
+ MjRhYzA3MjRlNTg1NGE5N2FhMDlkNDNmZjhlMTVmY2QxZjcwN2M5MDkwZmI0
14
+ MjhkZWE1ZjliMDZkNmEwMmYyNWQ5NmQxYzNhZTk3ZWYzZmQ0NWY5NjIwN2Q1
15
+ NGU5YzhhMDYzOTkwNTdiMDAxMmNmMjU3NjQ3NjFjNTYyMzM5ZTU=
File without changes
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 3.5"
10
+ gem "rdoc", "~> 3.12"
11
+ gem "bundler", "~> 1.0"
12
+ gem "jeweler", "~> 2.0"
13
+ # gem "rcov", ">= 0"
14
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 Bryce Anderson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,41 @@
1
+ = fun_with_testing
2
+
3
+ A bunch of useful assertions.
4
+
5
+ Usage:
6
+
7
+ # This might go in test/helper.rb, for example
8
+ class GemTestCase < Test::Unit::TestCase
9
+ include FunWith::Testing # includes all custom assertions
10
+ # include FunWith::Testing::Assertions::Basics # alternately, just include tests piecemeal
11
+ # include FunWith::Testing::Assertions::ActiveRecord # alternately, just include tests piecemeal
12
+ # include FunWith::Testing::Assertions::FunWithFiles # alternately, just include tests piecemeal
13
+ end
14
+
15
+ Then in test/test_gem.rb:
16
+
17
+ class TestGem < GemTestCase
18
+ def test_my_thing
19
+ assert_zero( 0 )
20
+ assert_not_zero( 1 )
21
+ assert_has_method( 1, :to_s )
22
+ # ... and so on down the line
23
+ end
24
+ end
25
+
26
+
27
+ == Contributing to fun_with_testing
28
+
29
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
30
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
31
+ * Fork the project.
32
+ * Start a feature/bugfix branch.
33
+ * Commit and push until you are happy with your contribution.
34
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
35
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
36
+
37
+ == Copyright
38
+
39
+ Copyright (c) 2014 Bryce Anderson. See LICENSE.txt for
40
+ further details.
41
+
data/Rakefile ADDED
@@ -0,0 +1,58 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "fun_with_testing"
18
+ gem.homepage = "http://github.com/darthschmoo/fun_with_testing"
19
+ gem.license = "MIT"
20
+ gem.summary = "A place to stash Test::Unit assertions I've found handy."
21
+ gem.description = "A place to stash Test::Unit assertions I've found handy. Use at your own risk"
22
+ gem.email = "keeputahweird@gmail.com"
23
+ gem.authors = ["Bryce Anderson"]
24
+
25
+ gem.files = Dir.glob( File.join( ".", "lib", "**", "*.rb" ) ) +
26
+ Dir.glob( File.join( ".", "test", "**", "*" ) ) +
27
+ %w( Gemfile Rakefile LICENSE.txt README.rdoc VERSION CHANGELOG.markdown )
28
+
29
+ # dependencies defined in Gemfile
30
+ end
31
+ Jeweler::RubygemsDotOrgTasks.new
32
+
33
+ require 'rake/testtask'
34
+ Rake::TestTask.new(:test) do |test|
35
+ test.libs << 'lib' << 'test'
36
+ test.pattern = 'test/**/test_*.rb'
37
+ test.verbose = true
38
+ end
39
+
40
+ # require 'rcov/rcovtask'
41
+ # Rcov::RcovTask.new do |test|
42
+ # test.libs << 'test'
43
+ # test.pattern = 'test/**/test_*.rb'
44
+ # test.verbose = true
45
+ # test.rcov_opts << '--exclude "gems/*"'
46
+ # end
47
+
48
+ task :default => :test
49
+
50
+ require 'rdoc/task'
51
+ Rake::RDocTask.new do |rdoc|
52
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
53
+
54
+ rdoc.rdoc_dir = 'rdoc'
55
+ rdoc.title = "fun_with_testing #{version}"
56
+ rdoc.rdoc_files.include('README*')
57
+ rdoc.rdoc_files.include('lib/**/*.rb')
58
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,108 @@
1
+ module FunWith
2
+ module Testing
3
+ module Assertions
4
+ module ActiveRecord
5
+ def assert_record_save( record, message = "")
6
+ result = record.save
7
+
8
+ message = "Record #{record} did not save properly. "
9
+ message += record.errors.map{ |k,v| "#{k} : #{v}"}.join(", ")
10
+
11
+ assert_block message do
12
+ result
13
+ end
14
+ end
15
+
16
+ # Usage: get("index"); assert_response_success( :template => "index" )
17
+ #
18
+ def assert_response_success( opts = {} )
19
+ assert_block "@response is nil" do
20
+ !@response.nil?
21
+ end
22
+
23
+ if @response.error?
24
+ puts @response.body
25
+ elsif @response.redirect?
26
+ raise Test::Unit::AssertionFailedError.new( "Expected success, was redirect to #{@response.redirected_to} with flash #{flash}" )
27
+ end
28
+
29
+ assert_response :success
30
+ assert_template opts[:template] if opts[:template]
31
+ end
32
+
33
+ def assert_response_redirect( opts = {} )
34
+ assert_block "@response is nil" do
35
+ !@response.nil?
36
+ end
37
+
38
+ if @response.error? || @response.client_error?
39
+ puts @response.body
40
+ puts "Flash:" + @response.flash.map{|k,v| "#{k} : #{v}"}.join(', ')
41
+ debugger
42
+ nil
43
+ elsif @response.success?
44
+ puts "OOPS: should have redirected. Instead went to #{@response.template.action_name}, flash: #{@response.flash.inspect}"
45
+ end
46
+
47
+ assert_response :redirect
48
+ assert_redirected_to opts[:to] if opts[:to]
49
+ end
50
+
51
+ def assert_no_errors_on( record, message = "" )
52
+ record.valid?
53
+ message = build_message( message,
54
+ "#{record.class.name} record should have no errors. Errors: ?",
55
+ record.errors.map{ |k,v| "[#{k} : #{v}]"}.join(", ")
56
+ )
57
+
58
+ assert_block message do
59
+ record.valid?
60
+ end
61
+ end
62
+
63
+ # TODO: Should be able to say which errors should be present
64
+ def assert_errors_on( record, message = "" )
65
+ message = build_message( message, "#{record.class.name} record should have errors.")
66
+
67
+ assert_block message do
68
+ !record.valid?
69
+ end
70
+ end
71
+
72
+ def assert_an_error_on( record, _field, error_says = nil )
73
+ message = build_message( "", "<?> should have an error on the <?> field.", record, _field )
74
+ assert_block message do
75
+ !record.errors[_field].blank?
76
+ end
77
+
78
+ unless error_says.blank?
79
+ message = build_message( "", "<?> should have an error on the <?> field that says <?>.", record, _field, error_says )
80
+ assert_block message do
81
+ # puts "Inside field error block"
82
+ # debugger
83
+ record.errors[_field].include?(error_says)
84
+ end
85
+ end
86
+ end
87
+
88
+ def assert_record_destroyed( record, message = "")
89
+ not_record_message = build_message(message, "<?> is not an ActiveRecord::Base object.", record)
90
+ new_record_message = build_message(message, "<?> should not be a new record in order to use assert_destroy().", record)
91
+ full_message = build_message(message, "<?> should have been destroyed.", record)
92
+
93
+ assert_block not_record_message do
94
+ record.is_a?(ActiveRecord::Base)
95
+ end
96
+
97
+ assert_block new_record_message do
98
+ record.new_record? == false
99
+ end
100
+
101
+ assert_block full_message do
102
+ record.class.find_by_id(record.id) == nil
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,178 @@
1
+ module FunWith
2
+ module Testing
3
+ module Assertions
4
+ module Basics
5
+ def assert_not_zero( actual, message = "" )
6
+ message = build_message(message, "should not be zero")
7
+
8
+ assert_block message do
9
+ actual != 0
10
+ end
11
+ end
12
+
13
+ def assert_zero( actual, message = "" )
14
+ message = build_message(message, "should be zero, not <#{actual}>")
15
+
16
+ assert_block message do
17
+ actual == 0
18
+ end
19
+ end
20
+
21
+ def assert_one( actual, message = "" )
22
+ message = build_message(message, "should be 1, not <#{actual}>")
23
+
24
+ assert_block message do
25
+ actual == 1
26
+ end
27
+ end
28
+
29
+ def assert_negative( actual, message = "" )
30
+ message = build_message(message, "should be negative, not <#{actual}>")
31
+
32
+ assert_block message do
33
+ actual < 0
34
+ end
35
+ end
36
+
37
+ def assert_true( actual, message = "" )
38
+ message = build_message(message, "should be true, not <#{actual}>")
39
+ assert_block message do
40
+ actual == true
41
+ end
42
+ end
43
+
44
+ def assert_false( actual, message = "" )
45
+ message = build_message(message, "should be false, not <#{actual}>")
46
+ assert_block message do
47
+ actual == false
48
+ end
49
+ end
50
+
51
+
52
+ def assert_blank( obj, message = "" )
53
+ if obj.respond_to?(:blank?)
54
+ full_message = build_message(message, "<?> should be blank.", obj)
55
+ else
56
+ full_message = build_message(message, "<?> does not respond to :blank? method.", obj)
57
+ end
58
+
59
+ assert_block full_message do
60
+ obj.respond_to?(:blank?) && obj.blank?
61
+ end
62
+ end
63
+
64
+ def assert_matches( string, regexp_or_string, message = "")
65
+ full_message = build_message(message, "<?> should match regex <?>", string, regexp_or_string)
66
+ assert_block full_message do
67
+ if regexp_or_string.is_a?(Regexp)
68
+ string.match(regexp_or_string) ? true : false
69
+ elsif regexp_or_string.is_a?(String)
70
+ string.include?(regexp_or_string)
71
+ end
72
+ end
73
+ end
74
+
75
+ def assert_doesnt_match( string, regexp, message = "")
76
+ full_message = build_message(message, "<?> should not match regex <?>", string, regexp)
77
+ assert_block full_message do
78
+ string.match(regexp) ? false : true
79
+ end
80
+ end
81
+
82
+
83
+ # check that the given variables were assigned non-nil values
84
+ # by the controller
85
+
86
+ # If successful, returns an array of assigned objects.
87
+ # You can do:
88
+ # account, phone_number = assert_assigns(:account, :phone_number)
89
+ # or
90
+ # order = assert_assigns(:order)
91
+ def assert_assigns(*args)
92
+ symbols_assigned = []
93
+ symbols_not_assigned = []
94
+
95
+ for sym in args
96
+ ((assigns(sym) != nil)? symbols_assigned : symbols_not_assigned) << sym
97
+ end
98
+
99
+ message = build_message("", "The following variables should have been assigned values by the controller: <?>", symbols_not_assigned.map{|s| "@#{s.to_s}"}.join(", "))
100
+
101
+ assert_block message do
102
+ symbols_not_assigned.length == 0
103
+ end
104
+
105
+ if symbols_assigned.length == 1
106
+ assigns(symbols_assigned.first)
107
+ else
108
+ symbols_assigned.map{|s| assigns(s)}
109
+ end
110
+ end
111
+
112
+ # Ick
113
+ # read as "assert greater than 5, <test_value>"
114
+ def assert_greater_than( reference_value, amount, message = "" )
115
+ message = build_message("", "second argument <?> should be greater than reference value <?>", amount, reference_value)
116
+
117
+ assert_block message do
118
+ amount > reference_value
119
+ end
120
+ end
121
+
122
+ # read as "assert less than 5, <test value>"
123
+ def assert_less_than( reference_value, amount, message = "" )
124
+ message = build_message("", "second argument <?> should be less than reference value <?>", amount, reference_value)
125
+
126
+ assert_block message do
127
+ amount < reference_value
128
+ end
129
+ end
130
+
131
+ # I think "assert_delta_in_range" already does this
132
+ def assert_times_are_close( t1, t2, window = 1, message = "")
133
+ message = build_message(message, "times should be within ? second of each other.", window)
134
+
135
+ assert_block message do
136
+ (t1 - t2).abs < window
137
+ end
138
+ end
139
+
140
+ def assert_equal_length( expected, actual, message = "" )
141
+ message = build_message( message, "items should be of equal length: expected: <?>, actual: <?>", expected.length, actual.length )
142
+
143
+ assert_block message do
144
+ expected.length == actual.length
145
+ end
146
+ end
147
+
148
+ def assert_equality_of_methods(*args)
149
+ expected = args[0]
150
+ actual = args[1]
151
+ methods = args[2..-1].flatten
152
+ message = "The following methods were not equal: "
153
+
154
+ unequal = []
155
+
156
+ for method in methods
157
+ exp = expected.send(method.to_sym)
158
+ act = actual.send(method.to_sym)
159
+ unless exp == act
160
+ unequal << method
161
+ message += "\n\t#{method} (#{exp.inspect},#{act.inspect})"
162
+ end
163
+ end
164
+
165
+ assert_block message do
166
+ unequal.blank?
167
+ end
168
+ end
169
+
170
+ def assert_has_instance_method( object, instance_method, message = "object #{object} should respond to #{instance_method.inspect}" )
171
+ assert_block( message ) do
172
+ object.instance_methods.include?( instance_method )
173
+ end
174
+ end
175
+ end
176
+ end
177
+ end
178
+ end
@@ -0,0 +1,108 @@
1
+ module FunWith
2
+ module Testing
3
+ module Assertions
4
+ module FunWithFiles
5
+ def assert_fwf_filepath( file, message = "" )
6
+ message = build_message( message, "File <#{file}> should be a FunWith::Files::FilePath")
7
+
8
+ assert_block message do
9
+ file.is_a?( FunWith::Files::FilePath )
10
+ end
11
+ end
12
+
13
+ def assert_file( file, message = "" )
14
+ assert_fwf_filepath( file, message )
15
+
16
+ message = build_message( message, "File should exist at <#{file}>." )
17
+
18
+ assert_block message do
19
+ file.exist?
20
+ end
21
+ end
22
+
23
+ def assert_no_file( file, message = "" )
24
+ assert_fwf_filepath( file, message )
25
+
26
+ message = build_message( message, "No file/directory should exist at <#{file}>." )
27
+
28
+ assert_block message do
29
+ ! file.exist?
30
+ end
31
+ end
32
+
33
+ def assert_directory( file, message = "" )
34
+ assert_fwf_filepath( file, message )
35
+
36
+ message = build_message( message, "<#{file}> should be a directory." )
37
+
38
+
39
+ assert_block message do
40
+ file.directory?
41
+ end
42
+ end
43
+
44
+ def assert_not_directory( file, message = "" )
45
+ assert_fwf_filepath( file, message )
46
+
47
+ message = build_message( message, "<#{file}> shouldn't be a directory." )
48
+
49
+
50
+ assert_block message do
51
+ ! file.directory?
52
+ end
53
+ end
54
+
55
+ def assert_empty_file( file, message = "" )
56
+ assert_fwf_filepath( file, message )
57
+
58
+ message = build_message( message, "Empty file should exist at <#{file}>." )
59
+
60
+
61
+ assert_block message do
62
+ file.exist? && file.empty?
63
+ end
64
+ end
65
+
66
+ def assert_empty_directory( file, message = "" )
67
+ assert_fwf_filepath( file, message )
68
+
69
+ message = build_message( message, "Empty directory should exist at <#{file}>." )
70
+
71
+ assert_block message do
72
+ file.directory? && file.empty?
73
+ end
74
+ end
75
+
76
+ def assert_file_has_content( file, message = "" )
77
+ assert_fwf_filepath( file, message )
78
+
79
+ message = build_message( message, "File should exist at <#{file}>, and have content." )
80
+
81
+ assert_block message do
82
+ file.exist? && !file.empty?
83
+ end
84
+ end
85
+
86
+ def assert_file_contents( file, content, message = "" )
87
+ assert_file( file )
88
+
89
+ case content
90
+ when String
91
+ # message = build_message( message, "File <#{file}> contents should be #{content[0..99].inspect}#{'...(truncated)' if content.length > 100}" )
92
+ assert_equal( content, file.read, message )
93
+ when Regexp
94
+ assert_match( content, file.read, message)
95
+ end
96
+ end
97
+
98
+ # Actually, because FilePath responds to =~, assert_match may work for this
99
+ # def assert_file_content_matches( file, regex_or_string, times = nil, message = "" )
100
+ # if
101
+ # if times.nil?
102
+ #
103
+ # end
104
+ # end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,13 @@
1
+ files = Dir.glob( File.join( File.dirname(__FILE__), "fun_with", "testing", "**", "*.rb" ) )
2
+
3
+ for file in files.map{ |f| f.gsub(/\.rb$/, '') }
4
+ require file
5
+ end
6
+
7
+
8
+ # FunWith::Testing.extend( FunWith::Testing::FwtExtensions )
9
+ # FunWith::Testing.assertion_modules << FunWith::Testing::Assertions::ActiveRecord
10
+ # FunWith::Testing.assertion_modules << FunWith::Testing::Assertions::Basics
11
+
12
+ FunWith::Testing.send(:include, FunWith::Testing::Assertions::Basics)
13
+ FunWith::Testing.send(:include, FunWith::Testing::Assertions::ActiveRecord)
data/test/helper.rb ADDED
@@ -0,0 +1,43 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+
4
+ begin
5
+ Bundler.setup(:default, :development)
6
+ rescue Bundler::BundlerError => e
7
+ $stderr.puts e.message
8
+ $stderr.puts "Run `bundle install` to install missing gems"
9
+ exit e.status_code
10
+ end
11
+ require 'test/unit'
12
+ require 'shoulda'
13
+
14
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
16
+ require 'fun_with_testing'
17
+
18
+ class Test::Unit::TestCase
19
+ end
20
+
21
+ # Any subclass of Test::Unit::TestCase seems to automatically hook into the test suite.
22
+ # Therefore, calling a test to see if it returns false makes the suite fail. Including
23
+ # to this class instead prevents that. I may need to more closely mimic Test::Unit::TestCase
24
+ # in order to test messages properly.
25
+ class MockUnitTest
26
+ def build_message( m, m2, obj = nil)
27
+ "#{m} #{m2} #{obj}"
28
+ end
29
+
30
+ def assert_block( msg, &block )
31
+ yield
32
+ end
33
+ end
34
+
35
+ class FunWith::Testing::TestCase < Test::Unit::TestCase
36
+ def extended_test_case( &block )
37
+ @case_class = Class.new( MockUnitTest )
38
+ @case_class.send( :include, FunWith::Testing )
39
+ @case = @case_class.new
40
+ yield if block_given?
41
+ end
42
+ end
43
+
@@ -0,0 +1,34 @@
1
+ require 'helper'
2
+
3
+ module FunWith
4
+ module Testing
5
+ class TestAssertions < FunWith::Testing::TestCase
6
+ context "testing :assert_zero()" do
7
+ setup do
8
+ extended_test_case
9
+ end
10
+
11
+ should "proclaim zero is zero" do
12
+ assert_equal true, @case.assert_zero( 0 )
13
+ end
14
+
15
+ should "refute the notion that zero is one" do
16
+ assert_equal false, @case.assert_zero( 1 )
17
+ end
18
+
19
+ should "demonstrate zero is not a potato" do
20
+ assert_equal false, @case.assert_zero( :potato )
21
+ end
22
+
23
+ should "prove beyond a shadow of a doubt that zero is not a grue" do
24
+ assert_equal false, @case.assert_zero( "grue" )
25
+ end
26
+
27
+ # curious why it doesn't have :to_f
28
+ should "acknowledge that Integer has instance_variable to :to_s" do
29
+ assert_equal( true, @case.assert_has_instance_method( Integer, :to_s ) )
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,31 @@
1
+ require 'helper'
2
+
3
+
4
+ class TestFunWithTesting < FunWith::Testing::TestCase
5
+ should "be plumbed properly" do
6
+ assert defined?( FunWith::Testing::Assertions )
7
+ assert defined?( FunWith::Testing::Assertions::ActiveRecord )
8
+ assert defined?( FunWith::Testing::Assertions::Basics )
9
+
10
+ assert_includes( FunWith::Testing::Assertions::Basics.instance_methods, :assert_blank )
11
+ assert_includes( FunWith::Testing::Assertions::Basics.instance_methods, :assert_blank )
12
+ assert_includes( FunWith::Testing::Assertions::Basics.instance_methods, :assert_greater_than )
13
+ assert_includes( FunWith::Testing::Assertions::Basics.instance_methods, :assert_zero )
14
+ assert_includes( FunWith::Testing::Assertions::ActiveRecord.instance_methods, :assert_no_errors_on )
15
+ end
16
+
17
+ should "access a listing of assertion modules" do
18
+ assert_includes( FunWith::Testing.included_modules, FunWith::Testing::Assertions::ActiveRecord )
19
+ assert_includes( FunWith::Testing.included_modules, FunWith::Testing::Assertions::Basics )
20
+ end
21
+
22
+ should "successfully get included in a subclass" do
23
+ klass = Class.new( Test::Unit::TestCase )
24
+
25
+ imethods = klass.instance_methods.select{|sym| sym.to_s =~ /^(assert|refute)_/ }
26
+ assert_not_include imethods, :assert_zero
27
+ klass.send( :include, FunWith::Testing )
28
+ imethods = klass.instance_methods.select{|sym| sym.to_s =~ /^(assert|refute)_/ }
29
+ assert_include( imethods, :assert_zero )
30
+ end
31
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fun_with_testing
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Bryce Anderson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: shoulda
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '3.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '3.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rdoc
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '3.12'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '3.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: jeweler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
69
+ description: A place to stash Test::Unit assertions I've found handy. Use at your
70
+ own risk
71
+ email: keeputahweird@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files:
75
+ - LICENSE.txt
76
+ - README.rdoc
77
+ files:
78
+ - ./lib/fun_with/testing/assertions/active_record.rb
79
+ - ./lib/fun_with/testing/assertions/basics.rb
80
+ - ./lib/fun_with/testing/assertions/fun_with_files.rb
81
+ - ./lib/fun_with_testing.rb
82
+ - ./test/helper.rb
83
+ - ./test/test_assertions.rb
84
+ - ./test/test_fun_with_testing.rb
85
+ - CHANGELOG.markdown
86
+ - Gemfile
87
+ - LICENSE.txt
88
+ - README.rdoc
89
+ - Rakefile
90
+ - VERSION
91
+ homepage: http://github.com/darthschmoo/fun_with_testing
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ! '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.2.2
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: A place to stash Test::Unit assertions I've found handy.
115
+ test_files: []