Sha256: 3d40a62675fe2c98bb106d92789a2eb013ca2b940cecb43fb168e0467e7449cf

Contents?: true

Size: 1.68 KB

Versions: 4

Compression:

Stored size: 1.68 KB

Contents

require 'spec_helper'

module Zeus
  describe Rails do
    subject(:rails) { Rails.new }

    context "#test_helper" do
      before(:each) do
        rails.should_receive(:require).with("minitest/unit")
      end

      it "when ENV['RAILS_TEST_HELPER'] is set helper is loaded from variable" do
        ENV['RAILS_TEST_HELPER'] = "a_test_helper"
        rails.should_receive(:require).with("a_test_helper")

        rails.test_helper
        ENV.clear
      end

      it "when spec_helper exists spec_helper is required" do
        mock_file_existence(ROOT_PATH + "/spec/spec_helper.rb", true)

        rails.should_receive(:require).with("spec_helper")

        rails.test_helper
      end

      it "when minitest_helper exists minitest_helper is required" do
        mock_file_existence(ROOT_PATH + "/spec/spec_helper.rb", false)
        mock_file_existence(ROOT_PATH + "/test/minitest_helper.rb", true)

        rails.should_receive(:require).with("minitest_helper")

        rails.test_helper
      end

      it "when there is no spec_helper or minitest_helper, test_helper is required" do
        mock_file_existence(ROOT_PATH + "/spec/spec_helper.rb", false)
        mock_file_existence(ROOT_PATH + "/test/minitest_helper.rb", false)

        rails.should_receive(:require).with("test_helper")

        rails.test_helper
      end
    end

    context "#gem_is_bundled?" do
      it "returns gem version from Gemfile.lock" do
        File.stub(:read).and_return("
GEM
  remote: https://rubygems.org/
  specs:
    exception_notification-rake (0.0.6)
      exception_notification (~> 3.0.1)
      rake (>= 0.9.0)
    rake (10.0.4)
")
        gem_is_bundled?('rake').should == '10.0.4'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
zeus-0.15.2 spec/rails_spec.rb
zeus-0.15.1 spec/rails_spec.rb
zeus-0.15.0 spec/rails_spec.rb
zeus-justinf-0.13.5 spec/rails_spec.rb