shoulda-context 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +4 -0
- data/Appraisals +15 -0
- data/MIT-LICENSE +1 -1
- data/README.md +2 -2
- data/Rakefile +7 -1
- data/gemfiles/3.0.gemfile +7 -0
- data/gemfiles/3.0.gemfile.lock +91 -0
- data/gemfiles/3.1.gemfile +9 -0
- data/gemfiles/3.1.gemfile.lock +113 -0
- data/gemfiles/3.2.gemfile +9 -0
- data/gemfiles/3.2.gemfile.lock +111 -0
- data/lib/shoulda/context/assertions.rb +8 -4
- data/lib/shoulda/context/context.rb +12 -10
- data/lib/shoulda/context/version.rb +1 -1
- data/shoulda-context.gemspec +3 -0
- data/test/shoulda/context_test.rb +8 -16
- data/test/shoulda/helpers_test.rb +45 -3
- data/test/shoulda/should_test.rb +2 -1
- metadata +64 -17
data/.travis.yml
ADDED
data/Appraisals
ADDED
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# shoulda-context
|
1
|
+
# shoulda-context [](http://badge.fury.io/rb/shoulda-context) [](https://travis-ci.org/thoughtbot/shoulda-context)
|
2
2
|
|
3
3
|
[Official Documentation](http://rubydoc.info/github/thoughtbot/shoulda-context/master/frames)
|
4
4
|
|
@@ -50,5 +50,5 @@ Thank you to all the [contributors](https://github.com/thoughtbot/shoulda-contex
|
|
50
50
|
|
51
51
|
## License
|
52
52
|
|
53
|
-
Shoulda is Copyright © 2006-
|
53
|
+
Shoulda is Copyright © 2006-2013 thoughtbot, inc.
|
54
54
|
It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
|
data/Rakefile
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'bundler/setup'
|
2
2
|
require 'bundler/gem_tasks'
|
3
3
|
require 'rake/testtask'
|
4
|
+
require 'appraisal'
|
4
5
|
|
5
6
|
$LOAD_PATH.unshift("lib")
|
6
7
|
load 'tasks/shoulda.rake'
|
@@ -11,5 +12,10 @@ Rake::TestTask.new do |t|
|
|
11
12
|
t.verbose = false
|
12
13
|
end
|
13
14
|
|
15
|
+
desc 'Test the plugin under all supported Rails versions.'
|
16
|
+
task :all => ['appraisal:cleanup', 'appraisal:install'] do
|
17
|
+
exec('rake appraisal test')
|
18
|
+
end
|
19
|
+
|
14
20
|
desc 'Default: run tests'
|
15
|
-
task :default => [:
|
21
|
+
task :default => [:all]
|
@@ -0,0 +1,91 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/rmcgeary/work/oss/shoulda-context
|
3
|
+
specs:
|
4
|
+
shoulda-context (1.0.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
abstract (1.0.0)
|
10
|
+
actionmailer (3.0.17)
|
11
|
+
actionpack (= 3.0.17)
|
12
|
+
mail (~> 2.2.19)
|
13
|
+
actionpack (3.0.17)
|
14
|
+
activemodel (= 3.0.17)
|
15
|
+
activesupport (= 3.0.17)
|
16
|
+
builder (~> 2.1.2)
|
17
|
+
erubis (~> 2.6.6)
|
18
|
+
i18n (~> 0.5.0)
|
19
|
+
rack (~> 1.2.5)
|
20
|
+
rack-mount (~> 0.6.14)
|
21
|
+
rack-test (~> 0.5.7)
|
22
|
+
tzinfo (~> 0.3.23)
|
23
|
+
activemodel (3.0.17)
|
24
|
+
activesupport (= 3.0.17)
|
25
|
+
builder (~> 2.1.2)
|
26
|
+
i18n (~> 0.5.0)
|
27
|
+
activerecord (3.0.17)
|
28
|
+
activemodel (= 3.0.17)
|
29
|
+
activesupport (= 3.0.17)
|
30
|
+
arel (~> 2.0.10)
|
31
|
+
tzinfo (~> 0.3.23)
|
32
|
+
activeresource (3.0.17)
|
33
|
+
activemodel (= 3.0.17)
|
34
|
+
activesupport (= 3.0.17)
|
35
|
+
activesupport (3.0.17)
|
36
|
+
appraisal (0.5.1)
|
37
|
+
bundler
|
38
|
+
rake
|
39
|
+
arel (2.0.10)
|
40
|
+
builder (2.1.2)
|
41
|
+
erubis (2.6.6)
|
42
|
+
abstract (>= 1.0.0)
|
43
|
+
i18n (0.5.0)
|
44
|
+
json (1.7.7)
|
45
|
+
mail (2.2.19)
|
46
|
+
activesupport (>= 2.3.6)
|
47
|
+
i18n (>= 0.4.0)
|
48
|
+
mime-types (~> 1.16)
|
49
|
+
treetop (~> 1.4.8)
|
50
|
+
mime-types (1.21)
|
51
|
+
mocha (0.9.12)
|
52
|
+
polyglot (0.3.3)
|
53
|
+
rack (1.2.8)
|
54
|
+
rack-mount (0.6.14)
|
55
|
+
rack (>= 1.0.0)
|
56
|
+
rack-test (0.5.7)
|
57
|
+
rack (>= 1.0)
|
58
|
+
rails (3.0.17)
|
59
|
+
actionmailer (= 3.0.17)
|
60
|
+
actionpack (= 3.0.17)
|
61
|
+
activerecord (= 3.0.17)
|
62
|
+
activeresource (= 3.0.17)
|
63
|
+
activesupport (= 3.0.17)
|
64
|
+
bundler (~> 1.0)
|
65
|
+
railties (= 3.0.17)
|
66
|
+
railties (3.0.17)
|
67
|
+
actionpack (= 3.0.17)
|
68
|
+
activesupport (= 3.0.17)
|
69
|
+
rake (>= 0.8.7)
|
70
|
+
rdoc (~> 3.4)
|
71
|
+
thor (~> 0.14.4)
|
72
|
+
rake (10.0.4)
|
73
|
+
rdoc (3.12.2)
|
74
|
+
json (~> 1.4)
|
75
|
+
test-unit (2.1.2)
|
76
|
+
thor (0.14.6)
|
77
|
+
treetop (1.4.12)
|
78
|
+
polyglot
|
79
|
+
polyglot (>= 0.3.1)
|
80
|
+
tzinfo (0.3.37)
|
81
|
+
|
82
|
+
PLATFORMS
|
83
|
+
ruby
|
84
|
+
|
85
|
+
DEPENDENCIES
|
86
|
+
appraisal (~> 0.5)
|
87
|
+
mocha (~> 0.9.10)
|
88
|
+
rails (= 3.0.17)
|
89
|
+
rake
|
90
|
+
shoulda-context!
|
91
|
+
test-unit (~> 2.1.0)
|
@@ -0,0 +1,113 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/rmcgeary/work/oss/shoulda-context
|
3
|
+
specs:
|
4
|
+
shoulda-context (1.0.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
actionmailer (3.1.8)
|
10
|
+
actionpack (= 3.1.8)
|
11
|
+
mail (~> 2.3.3)
|
12
|
+
actionpack (3.1.8)
|
13
|
+
activemodel (= 3.1.8)
|
14
|
+
activesupport (= 3.1.8)
|
15
|
+
builder (~> 3.0.0)
|
16
|
+
erubis (~> 2.7.0)
|
17
|
+
i18n (~> 0.6)
|
18
|
+
rack (~> 1.3.6)
|
19
|
+
rack-cache (~> 1.2)
|
20
|
+
rack-mount (~> 0.8.2)
|
21
|
+
rack-test (~> 0.6.1)
|
22
|
+
sprockets (~> 2.0.4)
|
23
|
+
activemodel (3.1.8)
|
24
|
+
activesupport (= 3.1.8)
|
25
|
+
builder (~> 3.0.0)
|
26
|
+
i18n (~> 0.6)
|
27
|
+
activerecord (3.1.8)
|
28
|
+
activemodel (= 3.1.8)
|
29
|
+
activesupport (= 3.1.8)
|
30
|
+
arel (~> 2.2.3)
|
31
|
+
tzinfo (~> 0.3.29)
|
32
|
+
activeresource (3.1.8)
|
33
|
+
activemodel (= 3.1.8)
|
34
|
+
activesupport (= 3.1.8)
|
35
|
+
activesupport (3.1.8)
|
36
|
+
multi_json (>= 1.0, < 1.3)
|
37
|
+
appraisal (0.5.1)
|
38
|
+
bundler
|
39
|
+
rake
|
40
|
+
arel (2.2.3)
|
41
|
+
builder (3.0.4)
|
42
|
+
erubis (2.7.0)
|
43
|
+
hike (1.2.1)
|
44
|
+
i18n (0.6.4)
|
45
|
+
jquery-rails (2.2.1)
|
46
|
+
railties (>= 3.0, < 5.0)
|
47
|
+
thor (>= 0.14, < 2.0)
|
48
|
+
json (1.7.7)
|
49
|
+
mail (2.3.3)
|
50
|
+
i18n (>= 0.4.0)
|
51
|
+
mime-types (~> 1.16)
|
52
|
+
treetop (~> 1.4.8)
|
53
|
+
mime-types (1.21)
|
54
|
+
mocha (0.9.12)
|
55
|
+
multi_json (1.2.0)
|
56
|
+
polyglot (0.3.3)
|
57
|
+
rack (1.3.10)
|
58
|
+
rack-cache (1.2)
|
59
|
+
rack (>= 0.4)
|
60
|
+
rack-mount (0.8.3)
|
61
|
+
rack (>= 1.0.0)
|
62
|
+
rack-ssl (1.3.3)
|
63
|
+
rack
|
64
|
+
rack-test (0.6.2)
|
65
|
+
rack (>= 1.0)
|
66
|
+
rails (3.1.8)
|
67
|
+
actionmailer (= 3.1.8)
|
68
|
+
actionpack (= 3.1.8)
|
69
|
+
activerecord (= 3.1.8)
|
70
|
+
activeresource (= 3.1.8)
|
71
|
+
activesupport (= 3.1.8)
|
72
|
+
bundler (~> 1.0)
|
73
|
+
railties (= 3.1.8)
|
74
|
+
railties (3.1.8)
|
75
|
+
actionpack (= 3.1.8)
|
76
|
+
activesupport (= 3.1.8)
|
77
|
+
rack-ssl (~> 1.3.2)
|
78
|
+
rake (>= 0.8.7)
|
79
|
+
rdoc (~> 3.4)
|
80
|
+
thor (~> 0.14.6)
|
81
|
+
rake (10.0.4)
|
82
|
+
rdoc (3.12.2)
|
83
|
+
json (~> 1.4)
|
84
|
+
sass (3.2.7)
|
85
|
+
sass-rails (3.1.7)
|
86
|
+
actionpack (~> 3.1.0)
|
87
|
+
railties (~> 3.1.0)
|
88
|
+
sass (>= 3.1.10)
|
89
|
+
tilt (~> 1.3.2)
|
90
|
+
sprockets (2.0.4)
|
91
|
+
hike (~> 1.2)
|
92
|
+
rack (~> 1.0)
|
93
|
+
tilt (~> 1.1, != 1.3.0)
|
94
|
+
test-unit (2.1.2)
|
95
|
+
thor (0.14.6)
|
96
|
+
tilt (1.3.6)
|
97
|
+
treetop (1.4.12)
|
98
|
+
polyglot
|
99
|
+
polyglot (>= 0.3.1)
|
100
|
+
tzinfo (0.3.37)
|
101
|
+
|
102
|
+
PLATFORMS
|
103
|
+
ruby
|
104
|
+
|
105
|
+
DEPENDENCIES
|
106
|
+
appraisal (~> 0.5)
|
107
|
+
jquery-rails
|
108
|
+
mocha (~> 0.9.10)
|
109
|
+
rails (= 3.1.8)
|
110
|
+
rake
|
111
|
+
sass-rails
|
112
|
+
shoulda-context!
|
113
|
+
test-unit (~> 2.1.0)
|
@@ -0,0 +1,111 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/rmcgeary/work/oss/shoulda-context
|
3
|
+
specs:
|
4
|
+
shoulda-context (1.0.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
actionmailer (3.2.9)
|
10
|
+
actionpack (= 3.2.9)
|
11
|
+
mail (~> 2.4.4)
|
12
|
+
actionpack (3.2.9)
|
13
|
+
activemodel (= 3.2.9)
|
14
|
+
activesupport (= 3.2.9)
|
15
|
+
builder (~> 3.0.0)
|
16
|
+
erubis (~> 2.7.0)
|
17
|
+
journey (~> 1.0.4)
|
18
|
+
rack (~> 1.4.0)
|
19
|
+
rack-cache (~> 1.2)
|
20
|
+
rack-test (~> 0.6.1)
|
21
|
+
sprockets (~> 2.2.1)
|
22
|
+
activemodel (3.2.9)
|
23
|
+
activesupport (= 3.2.9)
|
24
|
+
builder (~> 3.0.0)
|
25
|
+
activerecord (3.2.9)
|
26
|
+
activemodel (= 3.2.9)
|
27
|
+
activesupport (= 3.2.9)
|
28
|
+
arel (~> 3.0.2)
|
29
|
+
tzinfo (~> 0.3.29)
|
30
|
+
activeresource (3.2.9)
|
31
|
+
activemodel (= 3.2.9)
|
32
|
+
activesupport (= 3.2.9)
|
33
|
+
activesupport (3.2.9)
|
34
|
+
i18n (~> 0.6)
|
35
|
+
multi_json (~> 1.0)
|
36
|
+
appraisal (0.5.1)
|
37
|
+
bundler
|
38
|
+
rake
|
39
|
+
arel (3.0.2)
|
40
|
+
builder (3.0.4)
|
41
|
+
erubis (2.7.0)
|
42
|
+
hike (1.2.1)
|
43
|
+
i18n (0.6.4)
|
44
|
+
journey (1.0.4)
|
45
|
+
jquery-rails (2.2.1)
|
46
|
+
railties (>= 3.0, < 5.0)
|
47
|
+
thor (>= 0.14, < 2.0)
|
48
|
+
json (1.7.7)
|
49
|
+
mail (2.4.4)
|
50
|
+
i18n (>= 0.4.0)
|
51
|
+
mime-types (~> 1.16)
|
52
|
+
treetop (~> 1.4.8)
|
53
|
+
mime-types (1.21)
|
54
|
+
mocha (0.9.12)
|
55
|
+
multi_json (1.7.2)
|
56
|
+
polyglot (0.3.3)
|
57
|
+
rack (1.4.5)
|
58
|
+
rack-cache (1.2)
|
59
|
+
rack (>= 0.4)
|
60
|
+
rack-ssl (1.3.3)
|
61
|
+
rack
|
62
|
+
rack-test (0.6.2)
|
63
|
+
rack (>= 1.0)
|
64
|
+
rails (3.2.9)
|
65
|
+
actionmailer (= 3.2.9)
|
66
|
+
actionpack (= 3.2.9)
|
67
|
+
activerecord (= 3.2.9)
|
68
|
+
activeresource (= 3.2.9)
|
69
|
+
activesupport (= 3.2.9)
|
70
|
+
bundler (~> 1.0)
|
71
|
+
railties (= 3.2.9)
|
72
|
+
railties (3.2.9)
|
73
|
+
actionpack (= 3.2.9)
|
74
|
+
activesupport (= 3.2.9)
|
75
|
+
rack-ssl (~> 1.3.2)
|
76
|
+
rake (>= 0.8.7)
|
77
|
+
rdoc (~> 3.4)
|
78
|
+
thor (>= 0.14.6, < 2.0)
|
79
|
+
rake (10.0.4)
|
80
|
+
rdoc (3.12.2)
|
81
|
+
json (~> 1.4)
|
82
|
+
sass (3.2.7)
|
83
|
+
sass-rails (3.2.6)
|
84
|
+
railties (~> 3.2.0)
|
85
|
+
sass (>= 3.1.10)
|
86
|
+
tilt (~> 1.3)
|
87
|
+
sprockets (2.2.2)
|
88
|
+
hike (~> 1.2)
|
89
|
+
multi_json (~> 1.0)
|
90
|
+
rack (~> 1.0)
|
91
|
+
tilt (~> 1.1, != 1.3.0)
|
92
|
+
test-unit (2.1.2)
|
93
|
+
thor (0.17.0)
|
94
|
+
tilt (1.3.6)
|
95
|
+
treetop (1.4.12)
|
96
|
+
polyglot
|
97
|
+
polyglot (>= 0.3.1)
|
98
|
+
tzinfo (0.3.37)
|
99
|
+
|
100
|
+
PLATFORMS
|
101
|
+
ruby
|
102
|
+
|
103
|
+
DEPENDENCIES
|
104
|
+
appraisal (~> 0.5)
|
105
|
+
jquery-rails
|
106
|
+
mocha (~> 0.9.10)
|
107
|
+
rails (= 3.2.9)
|
108
|
+
rake
|
109
|
+
sass-rails
|
110
|
+
shoulda-context!
|
111
|
+
test-unit (~> 2.1.0)
|
@@ -54,10 +54,12 @@ module Shoulda # :nodoc:
|
|
54
54
|
if matcher.matches?(target)
|
55
55
|
assert_block { true }
|
56
56
|
if options[:message]
|
57
|
-
|
57
|
+
message = matcher.respond_to?(:failure_message_for_should_not) ? matcher.failure_message_for_should_not : matcher.negative_failure_message
|
58
|
+
assert_match options[:message], message
|
58
59
|
end
|
59
60
|
else
|
60
|
-
|
61
|
+
message = matcher.respond_to?(:failure_message_for_should) ? matcher.failure_message_for_should : matcher.failure_message
|
62
|
+
assert_block(message) { false }
|
61
63
|
end
|
62
64
|
end
|
63
65
|
|
@@ -73,10 +75,12 @@ module Shoulda # :nodoc:
|
|
73
75
|
if not_match
|
74
76
|
assert_block { true }
|
75
77
|
if options[:message]
|
76
|
-
|
78
|
+
message = matcher.respond_to?(:failure_message_for_should) ? matcher.failure_message_for_should : matcher.failure_message
|
79
|
+
assert_match options[:message], message
|
77
80
|
end
|
78
81
|
else
|
79
|
-
|
82
|
+
message = matcher.respond_to?(:failure_message_for_should_not) ? matcher.failure_message_for_should_not : matcher.negative_failure_message
|
83
|
+
assert_block(message) { false }
|
80
84
|
end
|
81
85
|
end
|
82
86
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Shoulda
|
2
2
|
module Context
|
3
3
|
class << self
|
4
|
-
attr_accessor :contexts
|
5
4
|
def contexts # :nodoc:
|
6
5
|
@contexts ||= []
|
7
6
|
end
|
7
|
+
attr_writer :contexts
|
8
8
|
|
9
9
|
def current_context # :nodoc:
|
10
10
|
self.contexts.last
|
@@ -226,7 +226,7 @@ module Shoulda
|
|
226
226
|
end
|
227
227
|
|
228
228
|
def subject_block # :nodoc:
|
229
|
-
@subject_block
|
229
|
+
@subject_block ||= nil
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
@@ -290,7 +290,13 @@ module Shoulda
|
|
290
290
|
attr_accessor :teardown_blocks # blocks given via teardown methods
|
291
291
|
attr_accessor :shoulds # array of hashes representing the should statements
|
292
292
|
attr_accessor :should_eventuallys # array of hashes representing the should eventually statements
|
293
|
-
|
293
|
+
|
294
|
+
# accessor with cache
|
295
|
+
def subject_block
|
296
|
+
return @subject_block if @subject_block
|
297
|
+
parent.subject_block
|
298
|
+
end
|
299
|
+
attr_writer :subject_block
|
294
300
|
|
295
301
|
def initialize(name, parent, &blk)
|
296
302
|
Shoulda::Context.add_context(self)
|
@@ -301,6 +307,7 @@ module Shoulda
|
|
301
307
|
self.shoulds = []
|
302
308
|
self.should_eventuallys = []
|
303
309
|
self.subcontexts = []
|
310
|
+
self.subject_block = nil
|
304
311
|
|
305
312
|
if block_given?
|
306
313
|
merge_block(&blk)
|
@@ -337,8 +344,8 @@ module Shoulda
|
|
337
344
|
if blk
|
338
345
|
self.shoulds << { :name => name, :before => options[:before], :block => blk }
|
339
346
|
else
|
340
|
-
|
341
|
-
|
347
|
+
self.should_eventuallys << { :name => name }
|
348
|
+
end
|
342
349
|
end
|
343
350
|
|
344
351
|
def should_not(matcher)
|
@@ -355,11 +362,6 @@ module Shoulda
|
|
355
362
|
self.subject_block = block
|
356
363
|
end
|
357
364
|
|
358
|
-
def subject_block
|
359
|
-
return @subject_block if @subject_block
|
360
|
-
parent.subject_block
|
361
|
-
end
|
362
|
-
|
363
365
|
def full_name
|
364
366
|
parent_name = parent.full_name if am_subcontext?
|
365
367
|
return [parent_name, name].join(" ").strip
|
data/shoulda-context.gemspec
CHANGED
@@ -12,12 +12,15 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.homepage = %q{http://thoughtbot.com/community/}
|
13
13
|
s.summary = %q{Context framework extracted from Shoulda}
|
14
14
|
s.description = %q{Context framework extracted from Shoulda}
|
15
|
+
s.license = %q{MIT}
|
15
16
|
|
16
17
|
s.files = `git ls-files`.split("\n")
|
17
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
20
|
s.require_paths = ["lib"]
|
20
21
|
|
22
|
+
s.add_development_dependency("appraisal", "~> 0.5")
|
23
|
+
s.add_development_dependency("rails", "3.2.9")
|
21
24
|
s.add_development_dependency("mocha", "~> 0.9.10")
|
22
25
|
s.add_development_dependency("rake")
|
23
26
|
s.add_development_dependency("test-unit", "~> 2.1.0")
|
@@ -6,17 +6,10 @@ class ContextTest < Test::Unit::TestCase # :nodoc:
|
|
6
6
|
context "with a subcontext made by a macro" do
|
7
7
|
setup { @context_macro = :foo }
|
8
8
|
|
9
|
-
merge_block
|
9
|
+
merge_block(&blk)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
# def self.context_macro(&blk)
|
14
|
-
# context "with a subcontext made by a macro" do
|
15
|
-
# setup { @context_macro = :foo }
|
16
|
-
# yield # <- this doesn't work.
|
17
|
-
# end
|
18
|
-
# end
|
19
|
-
|
20
13
|
context "context with setup block" do
|
21
14
|
setup do
|
22
15
|
@blah = "blah"
|
@@ -90,7 +83,7 @@ class ContextTest < Test::Unit::TestCase # :nodoc:
|
|
90
83
|
|
91
84
|
context "another context" do
|
92
85
|
should "not define @blah" do
|
93
|
-
|
86
|
+
assert !instance_variable_defined?(:@blah)
|
94
87
|
end
|
95
88
|
end
|
96
89
|
|
@@ -200,12 +193,12 @@ class ShouldMatcherTest < Test::Unit::TestCase
|
|
200
193
|
!@fail
|
201
194
|
end
|
202
195
|
|
203
|
-
def
|
204
|
-
"
|
196
|
+
def failure_message_for_should
|
197
|
+
"failure message for should"
|
205
198
|
end
|
206
199
|
|
207
|
-
def
|
208
|
-
"
|
200
|
+
def failure_message_for_should_not
|
201
|
+
"failure message for should not"
|
209
202
|
end
|
210
203
|
end
|
211
204
|
|
@@ -256,7 +249,7 @@ class ShouldMatcherTest < Test::Unit::TestCase
|
|
256
249
|
should "fail with a failing matcher" do
|
257
250
|
@matcher.fail = true
|
258
251
|
run_test_suite
|
259
|
-
assert_failed_with
|
252
|
+
assert_failed_with "failure message for should", @test_result
|
260
253
|
end
|
261
254
|
|
262
255
|
should "provide the subject" do
|
@@ -280,7 +273,7 @@ class ShouldMatcherTest < Test::Unit::TestCase
|
|
280
273
|
should "fail with a passing matcher" do
|
281
274
|
@matcher.fail = false
|
282
275
|
run_test_suite
|
283
|
-
assert_failed_with
|
276
|
+
assert_failed_with "failure message for should not", @test_result
|
284
277
|
end
|
285
278
|
|
286
279
|
should "provide the subject" do
|
@@ -365,4 +358,3 @@ class SubjectLazinessTest < Test::Unit::TestCase
|
|
365
358
|
assert_equal subject, subject
|
366
359
|
end
|
367
360
|
end
|
368
|
-
|
@@ -41,9 +41,9 @@ class HelpersTest < Test::Unit::TestCase # :nodoc:
|
|
41
41
|
|
42
42
|
context "a matching matcher" do
|
43
43
|
setup do
|
44
|
-
@matcher = stub('matcher', :matches?
|
45
|
-
:
|
46
|
-
:
|
44
|
+
@matcher = stub('matcher', :matches? => true,
|
45
|
+
:failure_message_for_should => 'bad failure message',
|
46
|
+
:failure_message_for_should_not => 'big time failure')
|
47
47
|
end
|
48
48
|
|
49
49
|
should "pass when given to assert_accepts with no message expectation" do
|
@@ -63,6 +63,7 @@ class HelpersTest < Test::Unit::TestCase # :nodoc:
|
|
63
63
|
context "when given to assert_rejects" do
|
64
64
|
context "and matcher has :does_not_match?" do
|
65
65
|
setup do
|
66
|
+
@error = nil
|
66
67
|
begin
|
67
68
|
@matcher.stubs(:matches?).returns(false)
|
68
69
|
@matcher.stubs(:does_not_match?).returns(true)
|
@@ -78,6 +79,7 @@ class HelpersTest < Test::Unit::TestCase # :nodoc:
|
|
78
79
|
|
79
80
|
context "and matcher does not have :does_not_match?" do
|
80
81
|
setup do
|
82
|
+
@error = nil
|
81
83
|
begin
|
82
84
|
assert_rejects @matcher, 'target'
|
83
85
|
rescue Test::Unit::AssertionFailedError => @error
|
@@ -96,6 +98,46 @@ class HelpersTest < Test::Unit::TestCase # :nodoc:
|
|
96
98
|
end
|
97
99
|
|
98
100
|
context "a non-matching matcher" do
|
101
|
+
setup do
|
102
|
+
@matcher = stub('matcher', :matches? => false,
|
103
|
+
:failure_message_for_should => 'big time failure',
|
104
|
+
:failure_message_for_should_not => 'bad failure message')
|
105
|
+
end
|
106
|
+
|
107
|
+
should "pass when given to assert_rejects with no message expectation" do
|
108
|
+
assert_rejects @matcher, 'target'
|
109
|
+
end
|
110
|
+
|
111
|
+
should "pass when given to assert_rejects with a matching message" do
|
112
|
+
assert_rejects @matcher, 'target', :message => /big time/
|
113
|
+
end
|
114
|
+
|
115
|
+
should "fail when given to assert_rejects with a non-matching message" do
|
116
|
+
assert_raise Test::Unit::AssertionFailedError do
|
117
|
+
assert_rejects @matcher, 'target', :message => /small time/
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
context "when given to assert_accepts" do
|
122
|
+
setup do
|
123
|
+
begin
|
124
|
+
assert_accepts @matcher, 'target'
|
125
|
+
rescue Test::Unit::AssertionFailedError => @error
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
should "fail" do
|
130
|
+
assert_not_nil @error
|
131
|
+
end
|
132
|
+
|
133
|
+
should "use the error message from the matcher" do
|
134
|
+
assert_equal 'big time failure', @error.message
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
context "a matcher using antiquated syntax" do
|
99
141
|
setup do
|
100
142
|
@matcher = stub('matcher', :matches? => false,
|
101
143
|
:failure_message => 'big time failure',
|
data/test/shoulda/should_test.rb
CHANGED
@@ -33,7 +33,7 @@ class ShouldTest < Test::Unit::TestCase # :nodoc:
|
|
33
33
|
|
34
34
|
def self.should_not_see_blah
|
35
35
|
should "not see @blah through a macro" do
|
36
|
-
|
36
|
+
assert !instance_variable_defined?(:@blah)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -141,6 +141,7 @@ class ShouldTest < Test::Unit::TestCase # :nodoc:
|
|
141
141
|
assert_nothing_raised do
|
142
142
|
parent = Shoulda::Context::Context.new("Parent", self) do; end
|
143
143
|
child = Shoulda::Context::Context.new("Child", parent) do; end
|
144
|
+
raise unless child.instance_of? Shoulda::Context::Context
|
144
145
|
end
|
145
146
|
end
|
146
147
|
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shoulda-context
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.2
|
5
4
|
prerelease:
|
5
|
+
version: 1.1.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- thoughtbot, inc.
|
@@ -14,56 +14,88 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date:
|
17
|
+
date: 2013-04-01 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
|
-
name:
|
20
|
+
name: appraisal
|
21
|
+
type: :development
|
21
22
|
requirement: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.5'
|
22
27
|
none: false
|
28
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
29
|
requirements:
|
24
30
|
- - ~>
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
27
|
-
|
32
|
+
version: '0.5'
|
33
|
+
none: false
|
28
34
|
prerelease: false
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rails
|
37
|
+
type: :development
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - '='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 3.2.9
|
43
|
+
none: false
|
29
44
|
version_requirements: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 3.2.9
|
49
|
+
none: false
|
50
|
+
prerelease: false
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: mocha
|
53
|
+
type: :development
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ~>
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: 0.9.10
|
30
59
|
none: false
|
60
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
61
|
requirements:
|
32
62
|
- - ~>
|
33
63
|
- !ruby/object:Gem::Version
|
34
64
|
version: 0.9.10
|
65
|
+
none: false
|
66
|
+
prerelease: false
|
35
67
|
- !ruby/object:Gem::Dependency
|
36
68
|
name: rake
|
69
|
+
type: :development
|
37
70
|
requirement: !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
71
|
requirements:
|
40
72
|
- - ! '>='
|
41
73
|
- !ruby/object:Gem::Version
|
42
74
|
version: '0'
|
43
|
-
type: :development
|
44
|
-
prerelease: false
|
45
|
-
version_requirements: !ruby/object:Gem::Requirement
|
46
75
|
none: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
47
77
|
requirements:
|
48
78
|
- - ! '>='
|
49
79
|
- !ruby/object:Gem::Version
|
50
80
|
version: '0'
|
81
|
+
none: false
|
82
|
+
prerelease: false
|
51
83
|
- !ruby/object:Gem::Dependency
|
52
84
|
name: test-unit
|
85
|
+
type: :development
|
53
86
|
requirement: !ruby/object:Gem::Requirement
|
54
|
-
none: false
|
55
87
|
requirements:
|
56
88
|
- - ~>
|
57
89
|
- !ruby/object:Gem::Version
|
58
90
|
version: 2.1.0
|
59
|
-
type: :development
|
60
|
-
prerelease: false
|
61
|
-
version_requirements: !ruby/object:Gem::Requirement
|
62
91
|
none: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
93
|
requirements:
|
64
94
|
- - ~>
|
65
95
|
- !ruby/object:Gem::Version
|
66
96
|
version: 2.1.0
|
97
|
+
none: false
|
98
|
+
prerelease: false
|
67
99
|
description: Context framework extracted from Shoulda
|
68
100
|
email: support@thoughtbot.com
|
69
101
|
executables:
|
@@ -72,12 +104,20 @@ extensions: []
|
|
72
104
|
extra_rdoc_files: []
|
73
105
|
files:
|
74
106
|
- .gitignore
|
107
|
+
- .travis.yml
|
108
|
+
- Appraisals
|
75
109
|
- CONTRIBUTING.md
|
76
110
|
- Gemfile
|
77
111
|
- MIT-LICENSE
|
78
112
|
- README.md
|
79
113
|
- Rakefile
|
80
114
|
- bin/convert_to_should_syntax
|
115
|
+
- gemfiles/3.0.gemfile
|
116
|
+
- gemfiles/3.0.gemfile.lock
|
117
|
+
- gemfiles/3.1.gemfile
|
118
|
+
- gemfiles/3.1.gemfile.lock
|
119
|
+
- gemfiles/3.2.gemfile
|
120
|
+
- gemfiles/3.2.gemfile.lock
|
81
121
|
- init.rb
|
82
122
|
- lib/shoulda-context.rb
|
83
123
|
- lib/shoulda/context.rb
|
@@ -103,26 +143,33 @@ files:
|
|
103
143
|
- test/shoulda/should_test.rb
|
104
144
|
- test/test_helper.rb
|
105
145
|
homepage: http://thoughtbot.com/community/
|
106
|
-
licenses:
|
146
|
+
licenses:
|
147
|
+
- MIT
|
107
148
|
post_install_message:
|
108
149
|
rdoc_options: []
|
109
150
|
require_paths:
|
110
151
|
- lib
|
111
152
|
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
-
none: false
|
113
153
|
requirements:
|
114
154
|
- - ! '>='
|
115
155
|
- !ruby/object:Gem::Version
|
156
|
+
segments:
|
157
|
+
- 0
|
158
|
+
hash: 2086514409947675977
|
116
159
|
version: '0'
|
117
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
160
|
none: false
|
161
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
162
|
requirements:
|
120
163
|
- - ! '>='
|
121
164
|
- !ruby/object:Gem::Version
|
165
|
+
segments:
|
166
|
+
- 0
|
167
|
+
hash: 2086514409947675977
|
122
168
|
version: '0'
|
169
|
+
none: false
|
123
170
|
requirements: []
|
124
171
|
rubyforge_project:
|
125
|
-
rubygems_version: 1.8.
|
172
|
+
rubygems_version: 1.8.23
|
126
173
|
signing_key:
|
127
174
|
specification_version: 3
|
128
175
|
summary: Context framework extracted from Shoulda
|