Sha256: f0da70e4e269c748925abd23ec06c4a1f942b4f73dd7f54b2abb0b0e97bd33a8

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

require "test_helper"

class ManageGeneratorTest < Rails::Generators::TestCase
  tests Sunrise::Scaffold::ManageGenerator
  destination File.expand_path("../../tmp", __FILE__)
  setup :prepare_destination

  test "Generate manage templates for single model" do
    run_generator %w(post)
    
    assert_file "app/controllers/manage/posts_controller.rb"
    assert_file "app/helpers/manage/posts_helper.rb"
    assert_file "spec/controllers/manage/posts_controller_spec.rb"
    
    # Views
    ["edit", "_form", "index", "_model_filter", "new", "_post", "show"].each do |file|
      assert_file "app/views/manage/posts/#{file}.html.erb"
    end
  end
  
  test "Generate manage templates for multiplay models" do
    run_generator %w(comment --parent=post)
    
    assert_file "app/controllers/manage/comments_controller.rb"
    assert_file "app/helpers/manage/comments_helper.rb"
    assert_file "spec/controllers/manage/comments_controller_spec.rb"
    # Views
    ["edit", "_form", "index", "_model_filter", "new", "_comment", "show"].each do |file|
      assert_file "app/views/manage/comments/#{file}.html.erb"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sunrise-scaffold-0.2.2 test/generators/manage_generator_test.rb
sunrise-scaffold-0.2.1 test/generators/manage_generator_test.rb
sunrise-scaffold-0.2.0 test/generators/manage_generator_test.rb