fun_with_testing 0.0.4 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,14 +4,12 @@ require 'helper'
4
4
  class TestFunWithTesting < FunWith::Testing::MyTestCase
5
5
  should "be plumbed properly" do
6
6
  assert defined?( FunWith::Testing::Assertions )
7
- assert defined?( FunWith::Testing::Assertions::ActiveRecord )
8
7
  assert defined?( FunWith::Testing::Assertions::Basics )
9
8
 
10
9
  assert_includes( FunWith::Testing::Assertions::Basics.instance_methods, :assert_blank )
11
10
  assert_includes( FunWith::Testing::Assertions::Basics.instance_methods, :assert_blank )
12
11
  assert_includes( FunWith::Testing::Assertions::Basics.instance_methods, :assert_greater_than )
13
12
  assert_includes( FunWith::Testing::Assertions::Basics.instance_methods, :assert_zero )
14
- assert_includes( FunWith::Testing::Assertions::ActiveRecord.instance_methods, :assert_no_errors_on )
15
13
  end
16
14
 
17
15
  should "have test/unit on board" do
@@ -20,7 +18,6 @@ class TestFunWithTesting < FunWith::Testing::MyTestCase
20
18
  end
21
19
 
22
20
  should "access a listing of assertion modules" do
23
- assert_includes( FunWith::Testing.included_modules, FunWith::Testing::Assertions::ActiveRecord )
24
21
  assert_includes( FunWith::Testing.included_modules, FunWith::Testing::Assertions::Basics )
25
22
  end
26
23
 
@@ -1,28 +1,29 @@
1
- require 'helper'
2
-
3
- module FunWith
4
- module Testing
5
- class TestTestMode < FunWith::Testing::MyTestCase
6
- context "testing in_test_mode?" do
7
- setup do
8
- extended_test_case
9
- @gem_to_test = Module.new
10
- end
11
-
12
- should "set into test mode by default" do
13
- @case_class.set_test_mode
14
- assert @case.in_test_mode?
15
- end
16
-
17
- should "explicitly set to false" do
18
- @case_class.set_test_mode( false )
19
- assert @case.in_test_mode? == false
20
- end
21
-
22
- should "return false when no gem is set" do
23
- assert @case.in_test_mode? == false
24
- end
25
- end
26
- end
27
- end
28
- end
1
+ # require 'helper'
2
+ #
3
+ # module FunWith
4
+ # module Testing
5
+ # class TestTestMode < FunWith::Testing::MyTestCase
6
+ # # TODO: "test mode" applies to gems, not to TestCases so this whole concept needs to be moved to FW::Gems
7
+ # _context "testing in_test_mode?" do
8
+ # setup do
9
+ # extended_test_case
10
+ # @gem_to_test = Module.new
11
+ # end
12
+ #
13
+ # should "set into test mode by default" do
14
+ # @case_class.set_test_mode
15
+ # assert @case.in_test_mode?
16
+ # end
17
+ #
18
+ # should "explicitly set to false" do
19
+ # @case_class.set_test_mode( false )
20
+ # assert @case.in_test_mode? == false
21
+ # end
22
+ #
23
+ # should "return false when no gem is set" do
24
+ # assert @case.in_test_mode? == false
25
+ # end
26
+ # end
27
+ # end
28
+ # end
29
+ # end
@@ -2,10 +2,11 @@ require 'helper'
2
2
 
3
3
  module FunWith
4
4
  module Testing
5
- class TestVerbosity < FunWith::Testing::MyTestCase
5
+ class TestVerbosity < FunWith::Testing::AssertionsTestCase
6
6
  context "testing in_test_mode?" do
7
7
  setup do
8
8
  extended_test_case
9
+ @case_class.install_verbosity
9
10
  end
10
11
 
11
12
  should "set into verbose by default" do
metadata CHANGED
@@ -1,123 +1,167 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fun_with_testing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryce Anderson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-31 00:00:00.000000000 Z
11
+ date: 2017-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: shoulda
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
- - - ! '>='
31
+ - - ">="
18
32
  - !ruby/object:Gem::Version
19
33
  version: '3.5'
20
- - - ~>
34
+ - - "~>"
21
35
  - !ruby/object:Gem::Version
22
36
  version: '3'
23
37
  type: :runtime
24
38
  prerelease: false
25
39
  version_requirements: !ruby/object:Gem::Requirement
26
40
  requirements:
27
- - - ! '>='
41
+ - - ">="
28
42
  - !ruby/object:Gem::Version
29
43
  version: '3.5'
30
- - - ~>
44
+ - - "~>"
31
45
  - !ruby/object:Gem::Version
32
46
  version: '3'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: rdoc
35
49
  requirement: !ruby/object:Gem::Requirement
36
50
  requirements:
37
- - - ~>
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 4.2.2
54
+ - - "~>"
38
55
  - !ruby/object:Gem::Version
39
- version: '3.12'
56
+ version: '4'
40
57
  type: :runtime
41
58
  prerelease: false
42
59
  version_requirements: !ruby/object:Gem::Requirement
43
60
  requirements:
44
- - - ~>
61
+ - - ">="
45
62
  - !ruby/object:Gem::Version
46
- version: '3.12'
63
+ version: 4.2.2
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '4'
47
67
  - !ruby/object:Gem::Dependency
48
68
  name: bundler
49
69
  requirement: !ruby/object:Gem::Requirement
50
70
  requirements:
51
- - - ~>
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '1.10'
74
+ - - "~>"
52
75
  - !ruby/object:Gem::Version
53
- version: '1.0'
76
+ version: '1'
54
77
  type: :runtime
55
78
  prerelease: false
56
79
  version_requirements: !ruby/object:Gem::Requirement
57
80
  requirements:
58
- - - ~>
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '1.10'
84
+ - - "~>"
59
85
  - !ruby/object:Gem::Version
60
- version: '1.0'
86
+ version: '1'
61
87
  - !ruby/object:Gem::Dependency
62
- name: jeweler
88
+ name: juwelier
63
89
  requirement: !ruby/object:Gem::Requirement
64
90
  requirements:
65
- - - ~>
91
+ - - ">="
66
92
  - !ruby/object:Gem::Version
67
- version: '2.0'
93
+ version: '2.1'
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2'
68
97
  type: :runtime
69
98
  prerelease: false
70
99
  version_requirements: !ruby/object:Gem::Requirement
71
100
  requirements:
72
- - - ~>
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '2.1'
104
+ - - "~>"
73
105
  - !ruby/object:Gem::Version
74
- version: '2.0'
106
+ version: '2'
75
107
  - !ruby/object:Gem::Dependency
76
108
  name: simplecov
77
109
  requirement: !ruby/object:Gem::Requirement
78
110
  requirements:
79
- - - ! '>='
111
+ - - ">="
80
112
  - !ruby/object:Gem::Version
81
- version: '0.8'
82
- - - ~>
113
+ version: '0.11'
114
+ - - "~>"
83
115
  - !ruby/object:Gem::Version
84
116
  version: '0'
85
117
  type: :runtime
86
118
  prerelease: false
87
119
  version_requirements: !ruby/object:Gem::Requirement
88
120
  requirements:
89
- - - ! '>='
121
+ - - ">="
90
122
  - !ruby/object:Gem::Version
91
- version: '0.8'
92
- - - ~>
123
+ version: '0.11'
124
+ - - "~>"
93
125
  - !ruby/object:Gem::Version
94
126
  version: '0'
95
127
  - !ruby/object:Gem::Dependency
96
- name: debugger
128
+ name: byebug
97
129
  requirement: !ruby/object:Gem::Requirement
98
130
  requirements:
99
- - - ~>
131
+ - - ">="
100
132
  - !ruby/object:Gem::Version
101
- version: '1.6'
133
+ version: '9.0'
134
+ - - "~>"
135
+ - !ruby/object:Gem::Version
136
+ version: '9'
102
137
  type: :runtime
103
138
  prerelease: false
104
139
  version_requirements: !ruby/object:Gem::Requirement
105
140
  requirements:
106
- - - ~>
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '9.0'
144
+ - - "~>"
107
145
  - !ruby/object:Gem::Version
108
- version: '1.6'
146
+ version: '9'
109
147
  - !ruby/object:Gem::Dependency
110
148
  name: minitest
111
149
  requirement: !ruby/object:Gem::Requirement
112
150
  requirements:
113
- - - ~>
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '5.9'
154
+ - - "~>"
114
155
  - !ruby/object:Gem::Version
115
156
  version: '5'
116
157
  type: :runtime
117
158
  prerelease: false
118
159
  version_requirements: !ruby/object:Gem::Requirement
119
160
  requirements:
120
- - - ~>
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: '5.9'
164
+ - - "~>"
121
165
  - !ruby/object:Gem::Version
122
166
  version: '5'
123
167
  description: A place to stash Test::Unit assertions I've found handy. Use at your
@@ -126,19 +170,21 @@ email: keeputahweird@gmail.com
126
170
  executables: []
127
171
  extensions: []
128
172
  extra_rdoc_files:
173
+ - CHANGELOG.markdown
129
174
  - LICENSE.txt
130
175
  - README.rdoc
131
176
  files:
132
- - ./lib/fun_with/testing/assertions/active_record.rb
133
- - ./lib/fun_with/testing/assertions/basics.rb
134
- - ./lib/fun_with/testing/assertions/fun_with_files.rb
135
- - ./lib/fun_with/testing/test_case.rb
136
- - ./lib/fun_with_testing.rb
137
- - ./test/helper.rb
138
- - ./test/test_assertions.rb
139
- - ./test/test_fun_with_testing.rb
140
- - ./test/test_test_mode.rb
141
- - ./test/test_verbosity.rb
177
+ - "./lib/fun_with/testing/assertions/basics.rb"
178
+ - "./lib/fun_with/testing/assertions_test_case.rb"
179
+ - "./lib/fun_with/testing/test_case.rb"
180
+ - "./lib/fun_with/testing/test_mode_methods.rb"
181
+ - "./lib/fun_with/testing/verbosity_methods.rb"
182
+ - "./lib/fun_with_testing.rb"
183
+ - "./test/helper.rb"
184
+ - "./test/test_assertions.rb"
185
+ - "./test/test_fun_with_testing.rb"
186
+ - "./test/test_test_mode.rb"
187
+ - "./test/test_verbosity.rb"
142
188
  - CHANGELOG.markdown
143
189
  - Gemfile
144
190
  - LICENSE.txt
@@ -155,17 +201,17 @@ require_paths:
155
201
  - lib
156
202
  required_ruby_version: !ruby/object:Gem::Requirement
157
203
  requirements:
158
- - - ! '>='
204
+ - - ">="
159
205
  - !ruby/object:Gem::Version
160
206
  version: '0'
161
207
  required_rubygems_version: !ruby/object:Gem::Requirement
162
208
  requirements:
163
- - - ! '>='
209
+ - - ">="
164
210
  - !ruby/object:Gem::Version
165
211
  version: '0'
166
212
  requirements: []
167
213
  rubyforge_project:
168
- rubygems_version: 2.2.2
214
+ rubygems_version: 2.6.6
169
215
  signing_key:
170
216
  specification_version: 4
171
217
  summary: A place to stash Test::Unit assertions I've found handy.
@@ -1,108 +0,0 @@
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
- safe_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
- safe_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 Minitest::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
- safe_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
- safe_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
- safe_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
- safe_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
- safe_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
- safe_assert_block not_record_message do
94
- record.is_a?(ActiveRecord::Base)
95
- end
96
-
97
- safe_assert_block new_record_message do
98
- record.new_record? == false
99
- end
100
-
101
- safe_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