Sha256: ec6c8e7970e1456a0cce24acb5054871f2ab96265ce88c4f183aa8d98610f88d

Contents?: true

Size: 1.69 KB

Versions: 11

Compression:

Stored size: 1.69 KB

Contents

require 'test_helper'
require 'rails/generators/test_case'
require 'rails/generators/cell/cell_generator'

class CellGeneratorTest < Rails::Generators::TestCase
  tests Rails::Generators::CellGenerator
  destination File.expand_path('../../tmp', File.dirname(__FILE__))
  setup :prepare_destination

  test 'create the standard assets' do
    skip("need to be implemented")
    run_generator %w(blog post latest)

    assert_file 'app/cells/blog_cell.rb', /class BlogCell < Cell::ViewModel/
    assert_file 'app/cells/blog_cell.rb', /def post/
    assert_file 'app/cells/blog_cell.rb', /def latest/
    assert_file 'app/cells/blog/post.haml', %r{app/cells/blog/post\.haml}
    assert_file 'app/cells/blog/post.haml', %r{<p>}
    assert_file 'app/cells/blog/latest.haml', %r{app/cells/blog/latest\.haml}
  end

  test 'create cell that inherits from custom cell class if specified' do
    run_generator %w(Blog --parent=ApplicationCell)
    assert_file 'app/cells/blog_cell.rb', /class BlogCell < ApplicationCell/
  end

  test 'work with namespaces' do
    skip("need to be implemented")
    run_generator %w(blog/post latest)
    assert_file 'app/cells/blog/post_cell.rb', /class Blog::PostCell < Cell::ViewModel/
    assert_file 'app/cells/blog/post_cell.rb', /def show/
    assert_file 'app/cells/blog/post_cell.rb', /def latest/
    assert_file 'app/cells/blog/post/latest.haml', %r{app/cells/blog/post/latest\.haml}
  end

  test 'work with namespaces and haml' do
    skip("need to be implemented")
    run_generator %w(blog/post latest)
    assert_file 'app/cells/blog/post_cell.rb', /class Blog::PostCell < Cell::ViewModel/
    assert_file 'app/cells/blog/post/latest.haml', %r{app/cells/blog/post/latest\.haml}
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
cells-hamlit2-0.2.0 test/cell_generator_test.rb
cells-hamlit2-0.1.1 test/cell_generator_test.rb
cells-haml-0.0.10 test/cell_generator_test.rb
cells-hamlit-0.2.0 test/cell_generator_test.rb
cells-haml-0.0.9 test/cell_generator_test.rb
cells-hamlit-0.1.1 test/cell_generator_test.rb
cells-hamlit-0.1.0 test/cell_generator_test.rb
cells-haml-0.0.8 test/cell_generator_test.rb
cells-haml-0.0.7 test/cell_generator_test.rb
cells-haml-0.0.6 test/cell_generator_test.rb
cells-haml-0.0.5 test/cell_generator_test.rb