7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/rspec-gherkin/rspec-loader.rb', line 7
def load(*paths, &block)
if paths.any? { |path| RSpecGherkin.feature?(path) }
::RSpec.configuration.filter_manager.exclusions.reject! do |key, value|
key == :feature || (key == :type && value == 'feature')
end
end
paths = paths.map do |path|
if RSpecGherkin.feature?(path)
spec_path = RSpecGherkin.feature_to_spec(path)
if File.exist?(spec_path)
spec_path
else
RSpecGherkin::Builder.build(path).features.each do |feature|
::RSpec::Core::ExampleGroup.describe(
"Feature: #{feature.name}", :type => :feature, :feature => true
) do
it do
example.metadata[:file_path] = spec_path
example.metadata[:line_number] = 1
pending('Not yet implemented')
end
end.register
end
nil
end
else
path
end
end.compact
paths.each do |path|
if RSpecGherkin.feature_spec?(path)
feature_path = RSpecGherkin.spec_to_feature(path)
if File.exists?(feature_path)
RSpecGherkin.features += RSpecGherkin::Builder.build(feature_path).features
end
end
end
super(*paths, &block) if paths.size > 0
end
|