Module: Bones::Plugins::Rspec

Extended by:
Rspec
Includes:
Helpers
Included in:
Rspec
Defined in:
lib/bones/plugins/rspec.rb

Instance Method Summary collapse

Instance Method Details

#define_tasksObject



35
36
37
38
# File 'lib/bones/plugins/rspec.rb', line 35

def define_tasks
  return unless have? :rspec
  @delegate.define_tasks
end

#initialize_rspecObject



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

#post_loadObject



30
31
32
33
# File 'lib/bones/plugins/rspec.rb', line 30

def post_load
  return unless have? :rspec
  @delegate.post_load
end