Sha256: d9a6bcf0c4c8aec8c5d5dbabba7a0a53edfea47922c3d8fcb9eb282a56efd8e9
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
require 'test_helper' class PublicTest < MiniTest::Spec class SongCell < Cell::ViewModel def initialize(controller, *args) @parent_controller = controller # TODO: this is removed in 4.0. @initialize_args = *args end attr_reader :initialize_args def show initialize_args.inspect end def detail "* #{initialize_args}" end end # ViewModel.cell returns the cell instance. it { Cell::ViewModel.cell("public_test/song", nil).must_be_instance_of SongCell } # ViewModel.cell passes options to cell. it { Cell::ViewModel.cell("public_test/song", nil, Object, genre: "Metal").initialize_args.must_equal [Object, {:genre=>"Metal"}] } # ViewModel.cell(collection: []) renders cells. it { Cell::ViewModel.cell("public_test/song", nil, collection: [Object, Module]).must_equal "[Object, {}]\n[Module, {}]" } # ViewModel.cell(collection: []) renders html_safe. it { Cell::ViewModel.cell("public_test/song", nil, collection: [Object]).class.must_equal ActiveSupport::SafeBuffer } # ViewModel.cell(collection: []) passes generic options to cell. it { Cell::ViewModel.cell("public_test/song", nil, collection: [Object, Module], genre: "Metal").must_equal "[Object, {:genre=>\"Metal\"}]\n[Module, {:genre=>\"Metal\"}]" } # ViewModel.cell(collection: [], method: :detail) invokes #detail instead of #show. it { Cell::ViewModel.cell("public_test/song", nil, collection: [Object, Module], method: :detail).must_equal "* [Object, {}]\n* [Module, {}]" } end # TODO: test AV::concept.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cells-jamie-4.0.0.alpha1 | test/vm/public_test.rb |