Sha256: 204f26e39b5653061489e6362ccf99acbbbbce863995d4385b52373a966cafaa

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

require 'support/config'
require 'support/test_helper'
require 'passenger/application'
include Passenger

describe Application do
	include TestHelper
	
	before :each do
		@stub = setup_rails_stub('foobar')
	end
	
	after :each do
		teardown_rails_stub
	end
	
	it "correctly detects Rails version numbers specified in environment.rb" do
		rails_version = Application.detect_framework_version(@stub.app_root)
		rails_version.should =~ /^2\.0\.(\d+)$/
	end
	
	it "returns :vendor if an application uses a vendored Rails" do
		@stub.use_vendor_rails('minimal')
		rails_version = Application.detect_framework_version(@stub.app_root)
		rails_version.should == :vendor
	end
	
	it "returns nil if an application does not specify its Rails version" do
		File.write(@stub.environment_rb) do |content|
			content.sub(/^RAILS_GEM_VERSION = .*$/, '')
		end
		rails_version = Application.detect_framework_version(@stub.app_root)
		rails_version.should be_nil
	end
	
	it "raises VersionNotFound if a nonexistant Rails version is specified" do
		File.write(@stub.environment_rb) do |content|
			content.sub(/^RAILS_GEM_VERSION = .*$/, "RAILS_GEM_VERSION = '1.9.1972'")
		end
		detector = lambda { Application.detect_framework_version(@stub.app_root) }
		detector.should raise_error(::Passenger::VersionNotFound)
	end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
passenger-2.0.1 test/ruby/application_spec.rb
passenger-2.0.2 test/ruby/application_spec.rb
passenger-2.0.3 test/ruby/application_spec.rb
passenger-2.0.4 test/ruby/application_spec.rb
passenger-2.0.5 test/ruby/application_spec.rb
passenger-2.0.6 test/ruby/application_spec.rb