Sha256: 0c4e181912eb8868faa2cee03ac16f75ccbb6ae9dcf19a13a122653045c287ac

Contents?: true

Size: 462 Bytes

Versions: 7

Compression:

Stored size: 462 Bytes

Contents

require 'rails/generators'

class MockGenerator < Rails::Generators::NamedBase

  source_root File.expand_path('../templates', __FILE__)

  def create_mock_file
    path = "app/mocks/#{file_name}_mock.rb"
    if FileTest.exists?path
      raise FileExistError, "This filename ist used by another mock:#{path}"
    end

    copy_file "mock_template.rb", path
    gsub_file path, '-MockName-' , "#{class_name}"
  end

end

class FileExistError < StandardError; end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
neo-rails-0.3.2 lib/generators/mock/mock_generator.rb
neo-rails-0.3.1 lib/generators/mock/mock_generator.rb
neo-rails-0.3 lib/generators/mock/mock_generator.rb
neo-rails-0.2.3.1 lib/generators/mock/mock_generator.rb
neo-rails-0.2.3 lib/generators/mock/mock_generator.rb
neo-rails-0.2.2 lib/generators/mock/mock_generator.rb
neo-rails-0.2.1 lib/generators/mock/mock_generator.rb