class Object
Public Instance Methods
and(other)
click to toggle source
# File lib/spectre/assertion.rb, line 32 def and other AndEvaluation.new self, other end
now()
click to toggle source
# File lib/spectre/helpers.rb, line 132 def now Time.now end
or(other)
click to toggle source
# File lib/spectre/assertion.rb, line 28 def or other OrEvaluation.new self, other end
should_be(val)
click to toggle source
# File lib/spectre/assertion.rb, line 8 def should_be(val) raise AssertionFailure.new("The value '#{self.to_s.trim}' should be '#{val.to_s.trim}'", val, self) unless self.to_s == val.to_s end
should_be_empty()
click to toggle source
# File lib/spectre/assertion.rb, line 12 def should_be_empty raise AssertionFailure.new("The value '#{self.to_s.trim}' should be empty", nil, self) unless self.nil? end
should_not_be(val)
click to toggle source
# File lib/spectre/assertion.rb, line 16 def should_not_be(val) raise AssertionFailure.new("The value '#{self.to_s.trim}' should not be '#{val.to_s.trim}'", val, self) unless self.to_s != val.to_s end
should_not_be_empty()
click to toggle source
# File lib/spectre/assertion.rb, line 24 def should_not_be_empty raise AssertionFailure.new('The value should not be empty', 'nothing', self) unless self != nil end
should_not_exist()
click to toggle source
# File lib/spectre/assertion.rb, line 20 def should_not_exist raise AssertionFailure.new("The value '#{self.to_s.trim}' should not exist, but it does", val, self) unless self.to_s != nil end
to_recursive_ostruct(hash)
click to toggle source
# File lib/spectre/environment.rb, line 3 def to_recursive_ostruct(hash) OpenStruct.new(hash.each_with_object({}) do |(key, val), memo| memo[key] = val.is_a?(Hash) ? to_recursive_ostruct(val) : val end) end
uuid(length = 5)
click to toggle source
# File lib/spectre/helpers.rb, line 127 def uuid length = 5 SecureRandom.uuid().gsub('-', '')[0..length-1] end