Sha256: 4ffc0e5eaebf18ed810ecb5c88b19dd75aa8aa7b6efbc6264b64a30092945447

Contents?: true

Size: 1003 Bytes

Versions: 54

Compression:

Stored size: 1003 Bytes

Contents

require 'mspec/guards/guard'

class Object
  # Helper for syntax-sensitive specs. The specs should be placed in a file in
  # the +versions+ subdirectory. For example, suppose language/method_spec.rb
  # contains specs whose syntax depends on the Ruby version. In the
  # language/method_spec.rb use the helper as follows:
  #
  #   language_version __FILE__, "method"
  #
  # Then add a file "language/versions/method_1.8.rb" for the specs that are
  # syntax-compatible with Ruby 1.8.x.
  #
  # The most version-specific file will be loaded. If the version is 1.8.6,
  # "method_1.8.6.rb" will be loaded if it exists, otherwise "method_1.8.rb"
  # will be loaded if it exists.
  def language_version(dir, name)
    path = File.dirname(File.expand_path(dir))

    [SpecGuard.ruby_version(:tiny), SpecGuard.ruby_version].each do |version|
      file = File.join path, "versions", "#{name}_#{version}.rb"
      if File.exists? file
        require file
        break
      end
    end

    nil
  end
end

Version data entries

54 entries across 54 versions & 3 rubygems

Version Path
rhodes-5.5.18 lib/extensions/mspec/mspec/helpers/language_version.rb
rhodes-5.5.17 lib/extensions/mspec/mspec/helpers/language_version.rb
rhodes-5.5.15 lib/extensions/mspec/mspec/helpers/language_version.rb
rhodes-5.5.0.22 lib/extensions/mspec/mspec/helpers/language_version.rb
rhodes-5.5.2 lib/extensions/mspec/mspec/helpers/language_version.rb
rhodes-5.5.0.7 lib/extensions/mspec/mspec/helpers/language_version.rb
rhodes-5.5.0.3 lib/extensions/mspec/mspec/helpers/language_version.rb
rhodes-5.5.0 lib/extensions/mspec/mspec/helpers/language_version.rb
tauplatform-1.0.3 lib/extensions/mspec/mspec/helpers/language_version.rb
tauplatform-1.0.2 lib/extensions/mspec/mspec/helpers/language_version.rb
tauplatform-1.0.1 lib/extensions/mspec/mspec/helpers/language_version.rb
mspec-1.5.20 lib/mspec/helpers/language_version.rb
mspec-1.5.19 lib/mspec/helpers/language_version.rb
mspec-1.5.18 lib/mspec/helpers/language_version.rb
rhodes-3.5.1.12 lib/extensions/mspec/mspec/helpers/language_version.rb
rhodes-3.3.5 lib/extensions/mspec/mspec/helpers/language_version.rb
rhodes-3.4.2 lib/extensions/mspec/mspec/helpers/language_version.rb
rhodes-3.3.4 lib/extensions/mspec/mspec/helpers/language_version.rb
rhodes-3.3.3 lib/extensions/mspec/mspec/helpers/language_version.rb
rhodes-3.3.3.beta.4 lib/extensions/mspec/mspec/helpers/language_version.rb