Class: KnapsackPro::Adapters::RSpecAdapter
Constant Summary
collapse
- TEST_DIR_PATTERN =
'spec/**{,/*/**}/*_spec.rb'
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from BaseAdapter
bind, #bind, #bind_queue_mode
Class Method Details
.test_path(example_group) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/knapsack_pro/adapters/rspec_adapter.rb', line 6
def self.test_path(example_group)
if defined?(Turnip) && Turnip::VERSION.to_i < 2
unless example_group[:turnip]
until example_group[:parent_example_group].nil?
example_group = example_group[:parent_example_group]
end
end
else
until example_group[:parent_example_group].nil?
example_group = example_group[:parent_example_group]
end
end
example_group[:file_path]
end
|
Instance Method Details
#bind_before_queue_hook ⇒ Object
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/knapsack_pro/adapters/rspec_adapter.rb', line 70
def bind_before_queue_hook
::RSpec.configure do |config|
config.before(:suite) do
unless ENV['KNAPSACK_PRO_BEFORE_QUEUE_HOOK_CALLED']
KnapsackPro::Hooks::Queue.call_before_queue
ENV['KNAPSACK_PRO_BEFORE_QUEUE_HOOK_CALLED'] = 'true'
end
end
end
end
|
#bind_save_queue_report ⇒ Object
54
55
56
57
58
59
60
|
# File 'lib/knapsack_pro/adapters/rspec_adapter.rb', line 54
def bind_save_queue_report
::RSpec.configure do |config|
config.after(:suite) do
KnapsackPro::Report.save_subset_queue_to_file
end
end
end
|
#bind_save_report ⇒ Object
46
47
48
49
50
51
52
|
# File 'lib/knapsack_pro/adapters/rspec_adapter.rb', line 46
def bind_save_report
::RSpec.configure do |config|
config.after(:suite) do
KnapsackPro::Report.save
end
end
end
|
#bind_time_tracker ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/knapsack_pro/adapters/rspec_adapter.rb', line 22
def bind_time_tracker
::RSpec.configure do |config|
config.around(:each) do |example|
current_example_group =
if ::RSpec.respond_to?(:current_example)
::RSpec.current_example.metadata[:example_group]
else
example.metadata
end
KnapsackPro.tracker.current_test_path = KnapsackPro::Adapters::RSpecAdapter.test_path(current_example_group)
KnapsackPro.tracker.start_timer
example.run
KnapsackPro.tracker.stop_timer
end
config.after(:suite) do
KnapsackPro.logger.debug(KnapsackPro::Presenter.global_time)
end
end
end
|
#bind_tracker_reset ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/knapsack_pro/adapters/rspec_adapter.rb', line 62
def bind_tracker_reset
::RSpec.configure do |config|
config.before(:suite) do
KnapsackPro.tracker.reset!
end
end
end
|