6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/bones/plugins/rspec.rb', line 6
def initialize_rspec
gemspec = Gem.loaded_specs['rspec']
if gemspec
version = gemspec.version.segments.first
path = File.expand_path("../../rspec/rspec_version#{version}", __FILE__)
require path
@delegate = Bones::Rspec.const_get "RspecVersion#{version}"
have?(:rspec) { @delegate.initialize_rspec }
else
version = 2
while (version > 0)
path = File.expand_path("../../rspec/rspec_version#{version}", __FILE__)
require path
@delegate = Bones::Rspec.const_get "RspecVersion#{version}"
have?(:rspec) { @delegate.initialize_rspec }
break if have? :rspec
version -= 1
end
end
end
|