Improve current_spec_is? helper
* And movo it to helpers Change-Id: I28da74f325ad9cfc3f5efca6d7e0eb248989e1a2
This commit is contained in:
parent
a9e2e85bdd
commit
7873a11647
|
@ -98,5 +98,21 @@ module Noop
|
|||
lambda { ral_catalog }
|
||||
end
|
||||
|
||||
# Check if the currently running spec is the given one
|
||||
# or one of the given ones if an array is provided
|
||||
# @param spec [String, Array<String>]
|
||||
# @return [true,false]
|
||||
def current_spec_is?(spec)
|
||||
return false unless file_name_spec_set?
|
||||
spec = [spec] unless spec.is_a? Array
|
||||
spec = spec.flatten
|
||||
spec = spec.map do |spec|
|
||||
Noop::Utils.convert_to_spec spec
|
||||
end
|
||||
spec.any? do |spec|
|
||||
file_name_spec == spec
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,14 +14,6 @@ module Noop
|
|||
not @file_name_spec.nil?
|
||||
end
|
||||
|
||||
# Check if the currently running spec is the same as the given one
|
||||
# @return [true,false]
|
||||
def current_spec_is?(spec)
|
||||
return false unless file_name_spec_set?
|
||||
spec = Noop::Utils.convert_to_spec spec
|
||||
file_name_spec == spec
|
||||
end
|
||||
|
||||
# @return [Pathname]
|
||||
def file_base_spec
|
||||
Noop::Utils.convert_to_path(file_name_spec.to_s.gsub /_spec\.rb$/, '')
|
||||
|
|
Loading…
Reference in New Issue