Sha256: 62a00915361362d9835ba880b6c4b73ff58196a99cfeb4a46863fa26cf7a87c7

Contents?: true

Size: 718 Bytes

Versions: 6

Compression:

Stored size: 718 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 }

  it do
    cell = ParentCell.(model, admin: true, context: { user: user, controller: controller })
    # cell.extend(ParentController)

    cell.model.must_equal model
    cell.controller.must_equal controller
    cell.user.must_equal user

    # nested cell
    child = cell.cell("context_test/parent", "")

    child.model.must_equal ""
    child.controller.must_equal controller
    child.user.must_equal user
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cells-4.1.4 test/context_test.rb
cells-4.1.3 test/context_test.rb
cells-4.1.2 test/context_test.rb
cells-4.1.1 test/context_test.rb
cells-4.1.0 test/context_test.rb
cells-4.1.0.rc1 test/context_test.rb