Module: MiniSpec

Extended by:
MiniSpec
Included in:
MiniSpec
Defined in:
lib/minispec.rb,
lib/minispec/mocks.rb,
lib/minispec/proxy.rb,
lib/minispec/utils.rb,
lib/minispec/reporter.rb,
lib/minispec/api/class.rb,
lib/minispec/mocks/stubs.rb,
lib/minispec/utils/raise.rb,
lib/minispec/utils/throw.rb,
lib/minispec/api/instance.rb,
lib/minispec/utils/differ.rb,
lib/minispec/api/class/let.rb,
lib/minispec/api/class/after.rb,
lib/minispec/api/class/tests.rb,
lib/minispec/api/class/around.rb,
lib/minispec/api/class/before.rb,
lib/minispec/api/class/helpers.rb,
lib/minispec/mocks/validations.rb,
lib/minispec/mocks/expectations.rb,
lib/minispec/utils/pretty_print.rb,
lib/minispec/api/instance/mocks/mocks.rb,
lib/minispec/api/instance/mocks/spies.rb,
lib/minispec/api/instance/mocks/stubs.rb,
lib/minispec/api/instance/mocks/doubles.rb

Overview

Copyright © 2013 John Mair (banisterfiend)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Defined Under Namespace

Modules: ClassAPI, ExceptionInspector, InstanceAPI, Mocks, ThrowInspector, Utils Classes: Differ, ExceptionError, PrettyPrint, Proxy, Reporter, ThrowError

Constant Summary collapse

DEFAULT_PATTERN =

files loading pattern. relative to ‘Dir.pwd`

"{spec,test}/**/{*_spec.rb,*_test.rb,test_*.rb}".freeze
SPEC_WRAPPERS =
%w[
  describe
  context
  section
].freeze
TEST_WRAPPERS =
%w[
  test
  testing
  example
  should
  it
].freeze
IMPORTABLES =
%w[
  tests
  helpers
  before
  after
  around
  vars
  continue_on_failures
].map(&:to_sym).freeze
AFFIRMATIONS =
%w[
  is   is?
  are  are?
  was  was?
  does does?
  did  did?
  have have?
  has  has?
  assert
  affirm
  assume
  assure
  expect
  verify
  check
  prove
  would
  will
].freeze
NEGATIONS =
%w[
  refute
  negate
  fail_if
  not_expected
  assert_not
].freeze

Instance Method Summary collapse

Instance Method Details

#source_location_cache(file) ⇒ Object



68
69
70
71
# File 'lib/minispec.rb', line 68

def source_location_cache file
  return unless File.file?(file) && File.readable?(file)
  (@source_location_cache ||= {})[file] ||= File.readlines(file)
end