Skip to content

Commit ca907cf

Browse files
committed
Load RSpec configuration before accessing it
1 parent 3daebd5 commit ca907cf

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/generators/rspec.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,19 @@ def self.source_root(path = nil)
2020
end
2121
end
2222

23+
# This is specifically to parse and load `.rspec` file,
24+
# So we can use different directory.
25+
def self.configuration
26+
@configuration ||= begin
27+
configuration = RSpec.configuration
28+
options = RSpec::Core::ConfigurationOptions.new({})
29+
options.configure(configuration)
30+
configuration
31+
end
32+
end
33+
2334
def target_path(*paths)
24-
File.join(RSpec.configuration.default_path, *paths)
35+
File.join(self.class.configuration.default_path, *paths)
2536
end
2637
end
2738
end

0 commit comments

Comments
 (0)