Module: RspecExtensions::BehaviorDSL
- Defined in:
- lib/rspec_tapas/behavior_dsl.rb
Defined Under Namespace
Classes: BehaviorNotification
Instance Method Summary
collapse
Instance Method Details
#behavior(name, using: nil) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/rspec_tapas/behavior_dsl.rb', line 14
def behavior(name, using: nil)
if using.present?
@controller_actions_called = []
callback = lambda do |*args|
options = args.
@controller_actions_called << "#{options[:controller]}##{options[:action]}"
end
ActiveSupport::Notifications.subscribed(callback, 'start_processing.action_controller') do
yield
end
expect(@controller_actions_called).to(
include(using),
"expected #{using} to be used for #{name}, but it was not"
)
else
yield
end
reporter.example_passed(BehaviorNotification.new(name))
end
|
#reporter ⇒ Object
36
37
38
|
# File 'lib/rspec_tapas/behavior_dsl.rb', line 36
def reporter
RSpec.current_example.reporter
end
|