Class: Proc

Inherits:
Object show all
Defined in:
lib/minitest/bacon.rb

Instance Method Summary collapse

Instance Method Details

#change?Boolean

Returns:

  • (Boolean)


176
177
178
179
180
181
# File 'lib/minitest/bacon.rb', line 176

def change?
  before = yield
  call
  after = yield
  before != after
end

#raise?(*exceptions) ⇒ Boolean

Returns:

  • (Boolean)


159
160
161
162
163
164
165
166
# File 'lib/minitest/bacon.rb', line 159

def raise?(*exceptions)
  exceptions = [RuntimeError] if exceptions.empty?
  call
rescue *exceptions => e
  e
else
  false
end

#throw?(sym) ⇒ Boolean

Returns:

  • (Boolean)


168
169
170
171
172
173
174
# File 'lib/minitest/bacon.rb', line 168

def throw?(sym)
  not catch(sym) {
    call
    return false
  }
  return true
end