Sha256: 78e6446c81914879bfb90198dd9c070a7d4512353f039ec593c4d5880e9f6a07
Contents?: true
Size: 1019 Bytes
Versions: 2
Compression:
Stored size: 1019 Bytes
Contents
require "test_helper" class ContextTest < MiniTest::Spec class ParentCell < Cell::ViewModel def user context[:user] end def controller context[:controller] end end let (:model) { Object.new } let (:user) { Object.new } let (:controller) { Object.new } let (:parent) { ParentCell.(model, admin: true, context: { user: user, controller: controller }) } it do parent.model.must_equal model parent.controller.must_equal controller parent.user.must_equal user # nested cell child = parent.cell("context_test/parent", "") child.model.must_equal "" child.controller.must_equal controller child.user.must_equal user end # child can add to context it do child = parent.cell(ParentCell, nil, context: { "is_child?" => true }) parent.context["is_child?"].must_equal nil child.model.must_equal nil child.controller.must_equal controller child.user.must_equal user child.context["is_child?"].must_equal true end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cells-4.1.6 | test/context_test.rb |
cells-4.1.5 | test/context_test.rb |