sixarm_ruby_minitest_assert_assign 1.0.0

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: 6f25298a93e21c76f315ff8b0feab6ccdbc3bf27
4
+ data.tar.gz: 21d8fcb78c3987c6652da965e68c9dee4593ca1a
5
+ SHA512:
6
+ metadata.gz: 746035910de399aeef360043efcfeca34409c0c65d3e4eaf4c0992a9d0ba1c4b77ded66f33ae69145f7a20e0df557b551c68963e9f53452d73464a84c0c651c4
7
+ data.tar.gz: 3f28ac6956ad49e04c52eb2f5399eb3e20e494b0cac69b5ce89c64adf307bc6e6043ad05b5090eb2b04aeeb629608b77daa59afb7e188dd59562eee3bb81360e
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
Binary file
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "rake"
3
+ require "rake/testtask"
4
+
5
+ task :default => :test
6
+
7
+ Rake::TestTask.new(:test) do |t|
8
+ t.libs.push("lib", "test")
9
+ t.pattern = "test/**/*.rb"
10
+ end
@@ -0,0 +1,18 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin rdoc
3
+ Please see README
4
+ =end
5
+
6
+ unless defined?(Minitest) then
7
+ # Minitest 5 and MiniTest 4 use different capitalizations.
8
+ module Minitest; end
9
+ MiniTest = Minitest # prevents minitest.rb from requiring back to us
10
+ require "minitest"
11
+ end
12
+
13
+ MiniTest = Minitest unless defined?(MiniTest)
14
+
15
+ require 'hashdiff'
16
+
17
+ require 'sixarm_ruby_minitest_assert_assign/minitest/assertions/assign'
18
+ require 'sixarm_ruby_minitest_assert_assign/minitest/expectations/assign'
@@ -0,0 +1,38 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin rdoc
3
+ Please see README
4
+ =end
5
+
6
+ module MiniTest::Assertions
7
+
8
+ ##
9
+ # Succeeds when +expect_value+ and +assigns(:assign_symbol)+ are equal.
10
+ #
11
+ def assert_assign(expect_value, assign_symbol, msg = nil)
12
+ shared_assign(expect_value, assign_symbol, msg)
13
+ actual_value = assigns(assign_symbol)
14
+ assert_equal(expect_value, actual_value, "Expected assigns(#{assign_symbol}) to equal expect_value:#{expect_value.inspect}." + append_msg(msg))
15
+ end
16
+
17
+ ##
18
+ # Succeeds when +expect_value+ and +assigns(:assign_symbol)+ are not equal.
19
+
20
+ def refute_assign(expect_value, assign_symbol, msg = nil)
21
+ shared_assign(expect_value, assign_symbol, msg)
22
+ actual_value = assigns(assign_symbol)
23
+ refute_equal(expect_value, actual_value, "Expected assigns(#{assign_symbol}) to not equal expect_value:#{expect_value.inspect}." + append_msg(msg))
24
+ end
25
+
26
+ private
27
+
28
+ def shared_assign(expect_value, assign_symbol, msg = nil)
29
+ refute_nil(expect_value, "Expected expect_value, but got nil." + append_msg(msg))
30
+ refute_nil(assign_symbol, "Expected assign_symbol, but got nil." + append_msg(msg))
31
+ refute_nil(assigns(assign_symbol), "Expected assigns(:#{assign_symbol}), but got nil." + append_msg(msg))
32
+ end
33
+
34
+ def append_msg(msg = nil)
35
+ msg ? " #{msg}" : ""
36
+ end
37
+
38
+ end
@@ -0,0 +1,10 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin rdoc
3
+ Please see README
4
+ =end
5
+
6
+ module Minitest::Expectations
7
+ infect_an_assertion :assert_assign, :must_assign
8
+ infect_an_assertion :refute_assign, :wont_assign
9
+ end
10
+
@@ -0,0 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "simplecov"
4
+ SimpleCov.start
5
+ require "sixarm_ruby_minitest_assert_assign"
6
+
7
+ require "sixarm_ruby_minitest_assert_assign_test/minitest/assertions/assign_test"
8
+ require "sixarm_ruby_minitest_assert_assign_test/minitest/expectations/assign_test"
@@ -0,0 +1,127 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "sixarm_ruby_minitest_assert_assign"
3
+
4
+ describe "Minitest" do
5
+
6
+ def assigns(x)
7
+ @assigns ||= {:a => :A}
8
+ @assigns[x]
9
+ end
10
+
11
+ describe "Assertions" do
12
+
13
+ describe "#assert_assign" do
14
+
15
+ describe "with typical cases" do
16
+
17
+ specify "valid" do
18
+ assert_assign(:A, :a)
19
+ end
20
+
21
+ specify "invalid" do
22
+ err = proc {
23
+ assert_assign(:B, :a)
24
+ }.must_raise MiniTest::Assertion
25
+ err.message.must_match(/\bto equal\b/)
26
+ end
27
+
28
+ end
29
+
30
+ describe "with degenerate cases" do
31
+
32
+ describe "with `expect_value` nil" do
33
+
34
+ specify "raise" do
35
+ err = proc {
36
+ assert_assign(nil, :a)
37
+ }.must_raise MiniTest::Assertion
38
+ err.message.must_match(/\bExpected expect_value, but got nil\b/)
39
+ end
40
+
41
+ end
42
+
43
+ describe "with `assign_symbol` nil" do
44
+
45
+ specify "raise" do
46
+ err = proc {
47
+ assert_assign(:A, nil)
48
+ }.must_raise MiniTest::Assertion
49
+ err.message.must_match(/\bExpected assign_symbol, but got nil\b/)
50
+ end
51
+
52
+ end
53
+
54
+ describe "with a `assign_symbol` that isn't set" do
55
+
56
+ specify "raise" do
57
+ err = proc {
58
+ assert_assign(:A, :z)
59
+ }.must_raise MiniTest::Assertion
60
+ err.message.must_match(/\bExpected assigns\(:z\), but got nil\b/)
61
+ end
62
+
63
+ end
64
+
65
+ end
66
+
67
+ end
68
+
69
+ describe "#refute_assign" do
70
+
71
+ describe "with typical cases" do
72
+
73
+ specify "valid" do
74
+ refute_assign(:B, :a)
75
+ end
76
+
77
+ specify "invalid" do
78
+ err = proc {
79
+ refute_assign(:A, :a)
80
+ }.must_raise MiniTest::Assertion
81
+ err.message.must_match(/\bto not equal\b/)
82
+ end
83
+
84
+ end
85
+
86
+ describe "with degenerate cases" do
87
+
88
+ describe "with `expect_value` nil" do
89
+
90
+ specify "raise" do
91
+ err = proc {
92
+ refute_assign(nil, :a)
93
+ }.must_raise MiniTest::Assertion
94
+ err.message.must_match(/\bExpected expect_value, but got nil\b/)
95
+ end
96
+
97
+ end
98
+
99
+ describe "with `assign_symbol` nil" do
100
+
101
+ specify "raise" do
102
+ err = proc {
103
+ refute_assign(:A, nil)
104
+ }.must_raise MiniTest::Assertion
105
+ err.message.must_match(/\bExpected assign_symbol, but got nil\b/)
106
+ end
107
+
108
+ end
109
+
110
+ describe "with a `assign_symbol` that isn't set" do
111
+
112
+ specify "raise" do
113
+ err = proc {
114
+ refute_assign(:A, :z)
115
+ }.must_raise MiniTest::Assertion
116
+ err.message.must_match(/\bExpected assigns\(:z\), but got nil\b/)
117
+ end
118
+
119
+ end
120
+
121
+ end
122
+
123
+ end
124
+
125
+ end
126
+
127
+ end
@@ -0,0 +1,127 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "sixarm_ruby_minitest_assert_assign"
3
+
4
+ describe "Minitest" do
5
+
6
+ def assigns(x)
7
+ @assigns ||= {:a => :A}
8
+ @assigns[x]
9
+ end
10
+
11
+ describe "Expectations" do
12
+
13
+ describe "#must_assign" do
14
+
15
+ describe "with typical cases" do
16
+
17
+ specify "valid" do
18
+ expect(:a).must_assign :A
19
+ end
20
+
21
+ specify "invalid" do
22
+ err = proc {
23
+ expect(:a).must_assign :B
24
+ }.must_raise MiniTest::Assertion
25
+ err.message.must_match(/\bto equal\b/)
26
+ end
27
+
28
+ end
29
+
30
+ describe "with degenerate cases" do
31
+
32
+ describe "with `expect_value` nil" do
33
+
34
+ specify "raise" do
35
+ err = proc {
36
+ expect(:a).must_assign nil
37
+ }.must_raise MiniTest::Assertion
38
+ err.message.must_match(/\bExpected expect_value, but got nil\b/)
39
+ end
40
+
41
+ end
42
+
43
+ describe "with `assign_symbol` nil" do
44
+
45
+ specify "raise" do
46
+ err = proc {
47
+ expect(nil).must_assign :A
48
+ }.must_raise MiniTest::Assertion
49
+ err.message.must_match(/\bExpected assign_symbol, but got nil\b/)
50
+ end
51
+
52
+ end
53
+
54
+ describe "with a `assign_symbol` that isn't set" do
55
+
56
+ specify "raise" do
57
+ err = proc {
58
+ expect(:z).must_assign :A
59
+ }.must_raise MiniTest::Assertion
60
+ err.message.must_match(/\bExpected assigns\(:z\), but got nil\b/)
61
+ end
62
+
63
+ end
64
+
65
+ end
66
+
67
+ end
68
+
69
+ describe "#wont_assign" do
70
+
71
+ describe "with typical cases" do
72
+
73
+ specify "valid" do
74
+ expect(:a).wont_assign(:B)
75
+ end
76
+
77
+ specify "invalid" do
78
+ err = proc {
79
+ expect(:a).wont_assign(:A)
80
+ }.must_raise MiniTest::Assertion
81
+ err.message.must_match(/\bto not equal\b/)
82
+ end
83
+
84
+ end
85
+
86
+ describe "with degenerate cases" do
87
+
88
+ describe "with `expect_value` nil" do
89
+
90
+ specify "raise" do
91
+ err = proc {
92
+ expect(:a).wont_assign nil
93
+ }.must_raise MiniTest::Assertion
94
+ err.message.must_match(/\bExpected expect_value, but got nil\b/)
95
+ end
96
+
97
+ end
98
+
99
+ describe "with `assign_symbol` nil" do
100
+
101
+ specify "raise" do
102
+ err = proc {
103
+ expect(nil).wont_assign(:A)
104
+ }.must_raise MiniTest::Assertion
105
+ err.message.must_match(/\bExpected assign_symbol, but got nil\b/)
106
+ end
107
+
108
+ end
109
+
110
+ describe "with a `assign_symbol` that isn't set" do
111
+
112
+ specify "raise" do
113
+ err = proc {
114
+ expect(:z).wont_assign(:A)
115
+ }.must_raise MiniTest::Assertion
116
+ err.message.must_match(/\bExpected assigns\(:z\), but got nil\b/)
117
+ end
118
+
119
+ end
120
+
121
+ end
122
+
123
+ end
124
+
125
+ end
126
+
127
+ end
metadata ADDED
@@ -0,0 +1,215 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sixarm_ruby_minitest_assert_assign
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - SixArm
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIGCTCCA/GgAwIBAgIJAK3igyLv2hNNMA0GCSq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/gNp8ufGuTVLWF9FUUdMNK+TMbghnifT8/1
45
+ n+ES/gQPOnvmVkLDGw==
46
+ -----END CERTIFICATE-----
47
+ date: 2017-11-29 00:00:00.000000000 Z
48
+ dependencies:
49
+ - !ruby/object:Gem::Dependency
50
+ name: hashdiff
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 0.3.7
56
+ - - "<"
57
+ - !ruby/object:Gem::Version
58
+ version: '2'
59
+ type: :runtime
60
+ prerelease: false
61
+ version_requirements: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 0.3.7
66
+ - - "<"
67
+ - !ruby/object:Gem::Version
68
+ version: '2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 12.2.1
76
+ - - "<"
77
+ - !ruby/object:Gem::Version
78
+ version: '13'
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 12.2.1
86
+ - - "<"
87
+ - !ruby/object:Gem::Version
88
+ version: '13'
89
+ - !ruby/object:Gem::Dependency
90
+ name: minitest
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 5.10.3
96
+ - - "<"
97
+ - !ruby/object:Gem::Version
98
+ version: '6'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: 5.10.3
106
+ - - "<"
107
+ - !ruby/object:Gem::Version
108
+ version: '6'
109
+ - !ruby/object:Gem::Dependency
110
+ name: yard
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: 0.9.9
116
+ - - "<"
117
+ - !ruby/object:Gem::Version
118
+ version: '2'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: 0.9.9
126
+ - - "<"
127
+ - !ruby/object:Gem::Version
128
+ version: '2'
129
+ - !ruby/object:Gem::Dependency
130
+ name: simplecov
131
+ requirement: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: 0.14.1
136
+ - - "<"
137
+ - !ruby/object:Gem::Version
138
+ version: '2'
139
+ type: :development
140
+ prerelease: false
141
+ version_requirements: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: 0.14.1
146
+ - - "<"
147
+ - !ruby/object:Gem::Version
148
+ version: '2'
149
+ - !ruby/object:Gem::Dependency
150
+ name: coveralls
151
+ requirement: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: 0.8.21
156
+ - - "<"
157
+ - !ruby/object:Gem::Version
158
+ version: '2'
159
+ type: :development
160
+ prerelease: false
161
+ version_requirements: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: 0.8.21
166
+ - - "<"
167
+ - !ruby/object:Gem::Version
168
+ version: '2'
169
+ description: A Minitest assertion & expectation to compare the assigns(:symbol) method,
170
+ which is typical of Rails controllers
171
+ email: sixarm@sixarm.com
172
+ executables: []
173
+ extensions: []
174
+ extra_rdoc_files: []
175
+ files:
176
+ - Rakefile
177
+ - lib/sixarm_ruby_minitest_assert_assign.rb
178
+ - lib/sixarm_ruby_minitest_assert_assign/minitest/assertions/assign.rb
179
+ - lib/sixarm_ruby_minitest_assert_assign/minitest/expectations/assign.rb
180
+ - test/sixarm_ruby_minitest_assert_assign_test.rb
181
+ - test/sixarm_ruby_minitest_assert_assign_test/minitest/assertions/assign_test.rb
182
+ - test/sixarm_ruby_minitest_assert_assign_test/minitest/expectations/assign_test.rb
183
+ homepage: http://sixarm.com/
184
+ licenses:
185
+ - Apache-2.0
186
+ - Artistic-2.0
187
+ - BSD-3-Clause
188
+ - GPL-3.0
189
+ - MIT
190
+ - MPL-2.0
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.6.13
209
+ signing_key:
210
+ specification_version: 4
211
+ summary: SixArm.com → Ruby → Minitest → assert_assign assert & expect
212
+ test_files:
213
+ - test/sixarm_ruby_minitest_assert_assign_test.rb
214
+ - test/sixarm_ruby_minitest_assert_assign_test/minitest/assertions/assign_test.rb
215
+ - test/sixarm_ruby_minitest_assert_assign_test/minitest/expectations/assign_test.rb
metadata.gz.sig ADDED
Binary file