Sha256: c67980297ad7b6c6565663e1df4c35bb37c2f18727e31efff0732011637684dc

Contents?: true

Size: 1.89 KB

Versions: 2

Compression:

Stored size: 1.89 KB

Contents

# encoding: UTF-8
require "spec_helper"

describe Mango::Dependencies do

  #################################################################################################

  describe "class constant and variable defaults" do
    it "supports ruby 1.9.2" do
      Mango::Dependencies::SUPPORTED_RUBY_VERSIONS.should == ["1.9.2"]
    end
  end

  #################################################################################################

  describe ".check_ruby_version" do
    before(:each) do
      $stderr = StringIO.new
    end

    after(:each) do
      $stderr = STDERR
    end

    def expected_message(version)
      @expected_message = <<-ERROR
This library supports Ruby 1.9.2, but you're using #{version}.
I recommend using Ruby Version Manager to install, manage and work with multiple Ruby environments.
http://rvm.beginrescueend.com/
      ERROR
    end

    it "aborts for ruby 1.8.6" do
      version = "1.8.6"
      lambda {
        Mango::Dependencies.check_ruby_version(version)
      }.should raise_exception(SystemExit, expected_message(version))
    end

    it "aborts for ruby 1.8.7" do
      version = "1.8.7"
      lambda {
        Mango::Dependencies.check_ruby_version(version)
      }.should raise_exception(SystemExit, expected_message(version))
    end

    it "aborts for ruby 1.9.0" do
      version = "1.9.0"
      lambda {
        Mango::Dependencies.check_ruby_version(version)
      }.should raise_exception(SystemExit, expected_message(version))
    end

    it "aborts for ruby 1.9.1" do
      version = "1.9.1"
      lambda {
        Mango::Dependencies.check_ruby_version(version)
      }.should raise_exception(SystemExit, expected_message(version))
    end

    it "doesn't abort for ruby 1.9.2" do
      version = "1.9.2"
      lambda {
        Mango::Dependencies.check_ruby_version(version)
      }.should_not raise_exception(SystemExit, expected_message(version))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mango-0.6.3 spec/lib/dependencies_spec.rb
mango-0.6.2 spec/lib/dependencies_spec.rb