Module: Polyrun::Quick

Defined in:
lib/polyrun/quick/runner.rb,
lib/polyrun/quick/errors.rb,
lib/polyrun/quick/matchers.rb,
lib/polyrun/quick/reporter.rb,
lib/polyrun/quick/assertions.rb,
lib/polyrun/quick/example_group.rb,
lib/polyrun/quick/example_runner.rb,
sig/polyrun/quick.rbs

Overview

Micro test runner: nested describe, it / test, before / after, let / let!, expect().to matchers, optional Polyrun::Quick.capybara! when the capybara gem is loaded.

Run: polyrun quick or polyrun quick spec/foo.rb

Coverage: when POLYRUN_COVERAGE=1 or (+config/polyrun_coverage.yml+ and POLYRUN_QUICK_COVERAGE=1), starts Coverage::Rails before loading quick files so stdlib Coverage records them.

Defined Under Namespace

Modules: Assertions, DSL, Matchers Classes: AssertionFailed, Collector, EqMatcher, Error, ExampleGroup, ExampleRunner, Expectation, FalseyMatcher, IncludeMatcher, RegexMatcher, Reporter, Runner, TruthyMatcher

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.collectorObject

Returns the value of attribute collector.



39
40
41
# File 'lib/polyrun/quick/runner.rb', line 39

def collector
  @collector
end

Class Method Details

.capybara!void

This method returns an undefined value.



41
42
43
# File 'lib/polyrun/quick/runner.rb', line 41

def capybara!
  @capybara_enabled = true
end

.capybara?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/polyrun/quick/runner.rb', line 45

def capybara?
  @capybara_enabled == true
end

.describe(name, &block) ⇒ Object



61
62
63
64
65
# File 'lib/polyrun/quick/runner.rb', line 61

def describe(name, &block)
  group = ExampleGroup.new(name)
  group.instance_eval(&block) if block
  (collector || raise(Error, "Polyrun::Quick.describe used outside polyrun quick")).register(group)
end

.install_spec_quality!(root: nil, output_path: nil) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/polyrun/quick/runner.rb', line 53

def install_spec_quality!(root: nil, output_path: nil)
  require_relative "../spec_quality"
  return unless Polyrun::SpecQuality.enabled?

  r = root || File.expand_path(Dir.pwd)
  Polyrun::SpecQuality.start!(root: r, output_path: output_path)
end

.reset_capybara_flag!void

This method returns an undefined value.



49
50
51
# File 'lib/polyrun/quick/runner.rb', line 49

def reset_capybara_flag!
  @capybara_enabled = false
end