Sha256: 63924f67e264b8b683ee37ebd62310b9b94ac104fcfd0e8193b9a261489b1c67

Contents?: true

Size: 1.53 KB

Versions: 7

Compression:

Stored size: 1.53 KB

Contents

require_relative '../test_helper'
require_relative '../../lib/generators/comfy/scaffold/scaffold_generator'

class ScaffoldGeneratorTest < Rails::Generators::TestCase
  tests Comfy::Generators::ScaffoldGenerator
  
  def test_generator
    run_generator %w(Foo bar:string)
    
    assert_migration 'db/migrate/create_foos.rb', read_file('scaffold/migration.rb')
    assert_file 'app/models/foo.rb',              read_file('scaffold/model.rb')
    assert_file 'test/models/foo_test.rb',        read_file('scaffold/tests/model.rb')
    assert_file 'test/fixtures/foos.yml',         read_file('scaffold/tests/fixture')
    
    assert_file 'app/controllers/admin/foos_controller.rb',       read_file('scaffold/controller.rb')
    assert_file 'test/controllers/admin/foos_controller_test.rb', read_file('scaffold/tests/controller.rb')
    
    assert_file 'app/views/admin/foos/index.html.haml', read_file('scaffold/views/index.haml')
    assert_file 'app/views/admin/foos/show.html.haml',  read_file('scaffold/views/show.haml')
    assert_file 'app/views/admin/foos/new.html.haml',   read_file('scaffold/views/new.haml')
    assert_file 'app/views/admin/foos/edit.html.haml',  read_file('scaffold/views/edit.haml')
    assert_file 'app/views/admin/foos/_form.html.haml', read_file('scaffold/views/_form.haml')
    
    assert_file 'config/routes.rb', read_file('scaffold/routes.rb')
    
    assert_file 'app/views/admin/cms/partials/_navigation_inner.html.haml' do |file|
      assert_match "%li= active_link_to 'Foos', admin_foos_path", file
    end
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.11.2 test/generators/scaffold_generator_test.rb
comfortable_mexican_sofa-1.11.1 test/generators/scaffold_generator_test.rb
comfortable_mexican_sofa-1.11.0 test/generators/scaffold_generator_test.rb
comfortable_mexican_sofa-1.10.3 test/generators/scaffold_generator_test.rb
comfortable_mexican_sofa-1.10.2 test/generators/scaffold_generator_test.rb
comfortable_mexican_sofa-1.10.1 test/generators/scaffold_generator_test.rb
comfortable_mexican_sofa-1.10.0 test/generators/scaffold_generator_test.rb