require 'test_helper' require 'gemfile_generator' # Stub out methods on upgrader class module Rails module Upgrading class GemfileGenerator attr_writer :environment_code def has_environment? true end def environment_code @environment_code end end end end class GemfileGeneratorTest < ActiveSupport::TestCase PREAMBLE = < 'kamping'", generator.generate_gemfile end def test_generates_with_all_options generator = Rails::Upgrading::GemfileGenerator.new generator.environment_code = "config.gem 'camping', :lib => 'kamping', :source => 'http://code.whytheluckystiff.net', :version => '2.1.1'" assert_equal PREAMBLE + "source 'http://code.whytheluckystiff.net'\ngem 'camping', '2.1.1', :require => 'kamping'", generator.generate_gemfile end end