Module: Crspec
- Defined in:
- lib/crspec/rails/assets_shim.rb,
lib/crspec.rb,
lib/crspec/cli.rb,
lib/crspec/dsl.rb,
lib/crspec/runner.rb,
lib/crspec/example.rb,
lib/crspec/version.rb,
lib/crspec/matchers.rb,
lib/crspec/mock/space.rb,
lib/crspec/mock/double.rb,
lib/crspec/expectations.rb,
lib/crspec/configuration.rb,
lib/crspec/example_group.rb,
lib/crspec/file_fixtures.rb,
lib/crspec/process_runner.rb,
lib/crspec/rails/parallel.rb,
lib/crspec/transpiler/cli.rb,
lib/crspec/generators/init.rb,
lib/crspec/shared_examples.rb,
lib/crspec/mock/interceptor.rb,
lib/crspec/execution_context.rb,
lib/crspec/status_persistence.rb,
lib/crspec/rails/system_server.rb,
lib/crspec/transpiler/rewriter.rb,
lib/crspec/rails/request_helpers.rb,
lib/crspec/mock/argument_matchers.rb,
lib/crspec/rails/database_isolation.rb,
lib/crspec/formatters/progress_formatter.rb,
sig/crspec.rbs
Overview
In many Rails controller/request specs the asset pipeline is not the
subject under test. When running under crspec, we provide a small shim
around Sprockets helpers so that missing compiled assets do not cause
hard failures.
Defined Under Namespace
Modules: DSL, Expectations, FailureAggregator, FileFixtures, Formatters, Generators, Matchers, Mock, Rails, SharedDSL, SharedRegistry, Transpiler
Classes: CLI, Configuration, Error, Example, ExampleGroup, ExecutionContext, ExpectationNotMetError, ExpectationTarget, MigrationError, MultipleExpectationsNotMetError, ProcessRunner, Runner, StatusPersistence, World
Constant Summary
collapse
- VERSION =
"0.1.5"
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
100
101
102
|
# File 'lib/crspec/configuration.rb', line 100
def configuration
@configuration ||= Configuration.new
end
|
104
105
106
|
# File 'lib/crspec/configuration.rb', line 104
def configure
yield configuration if block_given?
end
|
.describe(*args, **kwargs, &block) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/crspec/dsl.rb', line 39
def self.describe(*args, **kwargs, &block)
metadata = kwargs.dup
metadata.merge!(args.pop) if args.last.is_a?(Hash)
if metadata[:type].nil? && Crspec.configuration.infer_spec_type?
loc = caller_locations(1, 10).find { |l| l.path.include?("spec/") }
if loc
inferred = Crspec.configuration.infer_type_for_file_path(loc.path)
metadata[:type] = inferred if inferred
end
end
described = args.first.is_a?(Module) ? args.first : nil
description = described && args.size == 1 ? described : args.map(&:to_s).join(" ")
group = ExampleGroup.new(description, metadata, nil)
group.described_module = described
group.instance_eval(&block) if block
World.instance.register(group)
group
end
|
.fdescribe(*args, **kwargs, &block) ⇒ Object
74
75
76
|
# File 'lib/crspec/dsl.rb', line 74
def self.fdescribe(*args, **kwargs, &block)
describe(*args, **kwargs, &block).mark_focused!
end
|
.freeze_world! ⇒ Object
66
67
68
|
# File 'lib/crspec/dsl.rb', line 66
def self.freeze_world!
World.instance.freeze!
end
|
.reset! ⇒ Object
62
63
64
|
# File 'lib/crspec/dsl.rb', line 62
def self.reset!
World.reset!
end
|
.reset_configuration! ⇒ Object
108
109
110
|
# File 'lib/crspec/configuration.rb', line 108
def reset_configuration!
@configuration = Configuration.new
end
|
.shared_context(name, &block) ⇒ Object
33
34
35
|
# File 'lib/crspec/shared_examples.rb', line 33
def self.shared_context(name, &block)
SharedRegistry.register(name, block)
end
|
.shared_examples(name, &block) ⇒ Object
Also known as:
shared_examples_for
.world ⇒ Object
58
59
60
|
# File 'lib/crspec/dsl.rb', line 58
def self.world
World.instance
end
|
.xdescribe(*args, **kwargs, &block) ⇒ Object
70
71
72
|
# File 'lib/crspec/dsl.rb', line 70
def self.xdescribe(*args, **kwargs, &block)
describe(*args, **kwargs, &block).mark_pending!
end
|