Sha256: 54a2885c406807bba0e4c5531b5072c997cd1ded6d31c3b13da651993a5370ec

Contents?: true

Size: 1.16 KB

Versions: 41

Compression:

Stored size: 1.16 KB

Contents

require 'rubygems'
require 'ruby-debug'
require 'active_support'
require 'active_record'
require 'action_controller'
require 'action_view'

require 'shoulda'

require 'mocha'

require File.join(File.dirname(__FILE__), 'shoulda_macros', 'generator_macros')



require File.join(File.dirname(__FILE__), 'stolen_from_railties')

unless defined?(RAILS_DEFAULT_LOGGER)
  @test_log = File.join(RAILS_ROOT, 'test.log')
  RAILS_DEFAULT_LOGGER = Logger.new(@test_log)
end

Rails::Generator::Base.prepend_sources Rails::Generator::PathSource.new(:shoulda_generator, File.join(File.dirname(__FILE__), "..", "rails_generators"))

class GeneratorTestCase
  # Asserts that the given factory was created.
  def assert_generated_factory_for(name)
    assert_generated_file "test/factories/#{name.to_s.underscore}_factory.rb"
  end
  
  # Asserts that the given factory was NOT created.
  def deny_generated_factory_for(name)
    deny_file_exists "test/factories/#{name.to_s.underscore}_factory.rb"
  end
  
  # asserts that the given file DOES NOT exists
  def deny_file_exists(path)
    assert ! File.exist?("#{RAILS_ROOT}/#{path}"),
      "The file '#{RAILS_ROOT}/#{path}' should not exist"
  end
end

Version data entries

41 entries across 41 versions & 14 rubygems

Version Path
coreymartella-dmd_generator-0.2.3 test/test_helper.rb
drd-shoulda_generator-0.2.1 test/test_helper.rb
jeffleeismyhero-shoulda_generator-0.3.0 test/test_helper.rb
jeffleeismyhero-shoulda_generator-0.3.1 test/test_helper.rb
martijn-shoulda_generator-0.2.1 test/test_helper.rb
martijn-shoulda_generator-0.2.2 test/test_helper.rb
mattyoho-shoulda_generator-0.2.1 test/test_helper.rb
sob-shoulda_generator-0.2.1 test/test_helper.rb
stefanpenner-my_generator-0.1.1 test/test_helper.rb
stefanpenner-my_generator-0.1.2 test/test_helper.rb
stefanpenner-my_generator-0.1.3 test/test_helper.rb
stefanpenner-my_scaffold-0.1.3 test/test_helper.rb
stefanpenner-shoulda_generator-0.2.0 test/test_helper.rb
stefanpenner-shoulda_generator-0.2.1 test/test_helper.rb
stefanpenner-shoulda_generator-0.2.2 test/test_helper.rb
technicalpickles-shoulda_generator-0.2.0 test/test_helper.rb
technicalpickles-shoulda_generator-0.2.1 test/test_helper.rb
shoulda_machinist_generator-0.4.4 test/test_helper.rb
shoulda_machinist_generator-0.4.3 test/test_helper.rb
shoulda_machinist_generator-0.4.2 test/test_helper.rb