Fix incompatibility with case format in Ruby 1.9
This commit is contained in:
parent
f1be8d1cfd
commit
4dff6b88b4
|
@ -25,8 +25,10 @@ module ThoughtBot # :nodoc:
|
|||
collection = [collection] unless collection.is_a?(Array)
|
||||
msg = "#{x.inspect} not found in #{collection.to_a.inspect} #{extra_msg}"
|
||||
case x
|
||||
when Regexp: assert(collection.detect { |e| e =~ x }, msg)
|
||||
else assert(collection.include?(x), msg)
|
||||
when Regexp
|
||||
assert(collection.detect { |e| e =~ x }, msg)
|
||||
else
|
||||
assert(collection.include?(x), msg)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -36,8 +38,10 @@ module ThoughtBot # :nodoc:
|
|||
collection = [collection] unless collection.is_a?(Array)
|
||||
msg = "#{x.inspect} found in #{collection.to_a.inspect} " + extra_msg
|
||||
case x
|
||||
when Regexp: assert(!collection.detect { |e| e =~ x }, msg)
|
||||
else assert(!collection.include?(x), msg)
|
||||
when Regexp
|
||||
assert(!collection.detect { |e| e =~ x }, msg)
|
||||
else
|
||||
assert(!collection.include?(x), msg)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue