Module: Transpec

Defined in:
lib/transpec/rspec_dsl.rb,
lib/transpec.rb,
lib/transpec/cli.rb,
lib/transpec/git.rb,
lib/transpec/util.rb,
lib/transpec/record.rb,
lib/transpec/report.rb,
lib/transpec/syntax.rb,
lib/transpec/syntax.rb,
lib/transpec/syntax.rb,
lib/transpec/syntax.rb,
lib/transpec/project.rb,
lib/transpec/version.rb,
lib/transpec/ast/node.rb,
lib/transpec/converter.rb,
lib/transpec/syntax/its.rb,
lib/transpec/ast/builder.rb,
lib/transpec/file_finder.rb,
lib/transpec/syntax/have.rb,
lib/transpec/base_rewriter.rb,
lib/transpec/configuration.rb,
lib/transpec/context_error.rb,
lib/transpec/option_parser.rb,
lib/transpec/rspec_version.rb,
lib/transpec/syntax/double.rb,
lib/transpec/syntax/expect.rb,
lib/transpec/syntax/should.rb,
lib/transpec/commit_message.rb,
lib/transpec/syntax/example.rb,
lib/transpec/syntax/be_close.rb,
lib/transpec/dynamic_analyzer.rb,
lib/transpec/syntax/be_boolean.rb,
lib/transpec/syntax/mixin/send.rb,
lib/transpec/syntax/method_stub.rb,
lib/transpec/syntax/raise_error.rb,
lib/transpec/syntax/should_receive.rb,
lib/transpec/syntax/oneliner_should.rb,
lib/transpec/syntax/rspec_configure.rb,
lib/transpec/syntax/operator_matcher.rb,
lib/transpec/static_context_inspector.rb,
lib/transpec/syntax/mixin/should_base.rb,
lib/transpec/dynamic_analyzer/rewriter.rb,
lib/transpec/syntax/matcher_definition.rb,
lib/transpec/syntax/mixin/any_instance.rb,
lib/transpec/syntax/mixin/expectizable.rb,
lib/transpec/syntax/mixin/monkey_patch.rb,
lib/transpec/dynamic_analyzer/runtime_data.rb,
lib/transpec/syntax/mixin/allow_no_message.rb,
lib/transpec/syntax/mixin/have_matcher_owner.rb

Overview

Defined Under Namespace

Modules: AST, FileFinder, Git, RSpecDSL, Util, Version Classes: BaseRewriter, CLI, CommitMessage, Configuration, ContextError, Converter, DynamicAnalyzer, OptionParser, Project, RSpecVersion, Record, Report, StaticContextInspector, Syntax

Class Method Summary collapse

Class Method Details

.current_rspec_versionObject



27
28
29
30
# File 'lib/transpec.rb', line 27

def self.current_rspec_version
  require 'rspec/version'
  RSpecVersion.new(RSpec::Version::STRING)
end

.required_rspec_versionObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/transpec.rb', line 10

def self.required_rspec_version
  @required_rspec_version ||= begin
    gemspec_path = File.join(root, 'transpec.gemspec')
    gem_specification = Gem::Specification.load(gemspec_path)
    rspec_dependency = gem_specification.dependencies.find { |d| d.name == 'rspec' }

    if rspec_dependency
      rspec_requirement = rspec_dependency.requirement
      gem_version = rspec_requirement.requirements.first.find { |r| r.is_a?(Gem::Version) }
      RSpecVersion.new(gem_version)
    else
      # Using development version of RSpec with Bundler.
      current_rspec_version
    end
  end
end

.rootObject



6
7
8
# File 'lib/transpec.rb', line 6

def self.root
  File.expand_path('..', File.dirname(__FILE__))
end