shoulda 2.0.4 → 2.0.5
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/lib/shoulda/assertions.rb +8 -4
- data/lib/shoulda/context.rb +1 -1
- data/lib/shoulda/macros.rb +2 -2
- metadata +2 -2
data/lib/shoulda/assertions.rb
CHANGED
@@ -25,8 +25,10 @@ module ThoughtBot # :nodoc:
|
|
25
25
|
collection = [collection] unless collection.is_a?(Array)
|
26
26
|
msg = "#{x.inspect} not found in #{collection.to_a.inspect} #{extra_msg}"
|
27
27
|
case x
|
28
|
-
when Regexp
|
29
|
-
|
28
|
+
when Regexp
|
29
|
+
assert(collection.detect { |e| e =~ x }, msg)
|
30
|
+
else
|
31
|
+
assert(collection.include?(x), msg)
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
@@ -36,8 +38,10 @@ module ThoughtBot # :nodoc:
|
|
36
38
|
collection = [collection] unless collection.is_a?(Array)
|
37
39
|
msg = "#{x.inspect} found in #{collection.to_a.inspect} " + extra_msg
|
38
40
|
case x
|
39
|
-
when Regexp
|
40
|
-
|
41
|
+
when Regexp
|
42
|
+
assert(!collection.detect { |e| e =~ x }, msg)
|
43
|
+
else
|
44
|
+
assert(!collection.include?(x), msg)
|
41
45
|
end
|
42
46
|
end
|
43
47
|
end
|
data/lib/shoulda/context.rb
CHANGED
data/lib/shoulda/macros.rb
CHANGED
@@ -26,8 +26,8 @@ module ThoughtBot # :nodoc:
|
|
26
26
|
# Combinations of <tt>:by</tt>, <tt>:from</tt>, and <tt>:to</tt> are allowed:
|
27
27
|
#
|
28
28
|
# should_change "@post.title" # => assert the value changed in some way
|
29
|
-
# should_change "@post.title" :from => "old" # => assert the value changed to anything other than "old"
|
30
|
-
# should_change "@post.title" :to => "new" # => assert the value changed from anything other than "new"
|
29
|
+
# should_change "@post.title", :from => "old" # => assert the value changed to anything other than "old"
|
30
|
+
# should_change "@post.title", :to => "new" # => assert the value changed from anything other than "new"
|
31
31
|
def should_change(expression, options = {})
|
32
32
|
by, from, to = get_options!([options], :by, :from, :to)
|
33
33
|
stmt = "change #{expression.inspect}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shoulda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tammer Saleh
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-10-
|
12
|
+
date: 2008-10-15 00:00:00 -04:00
|
13
13
|
default_executable: convert_to_should_syntax
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|