Sha256: 475e5fddbb407db1ac8d9e4420774835522114b9a0fb7882e550ce446916325e

Contents?: true

Size: 1.11 KB

Versions: 18

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

require "assert"
require "much-rails/action/render_result"

class MuchRails::Action::RenderResult
  class UnitTests < Assert::Context
    desc "MuchRails::Action::RenderResult"
    subject{ unit_class }

    let(:unit_class){ MuchRails::Action::RenderResult }
  end

  class InitTests < UnitTests
    desc "when init"
    subject{ unit_class.new(view_model1, **render_kargs1) }

    let(:controller1){ FakeController.new }
    let(:view_model1){ Object.new }
    let(:render_kargs1) do
      { something: "TEST_VALUE" }
    end

    should have_readers :render_view_model, :render_kargs

    should "know its attributes" do
      assert_that(subject.render_view_model).equals(view_model1)
      assert_that(subject.render_kargs).equals(render_kargs1)

      controller1.instance_exec(subject, &subject.execute_block)
      assert_that(controller1.view).equals(view_model1)
      assert_that(controller1.render_called_with).equals(render_kargs1)
    end
  end

  class FakeController
    attr_reader :view, :render_called_with

    def render(**kargs)
      @render_called_with = kargs
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
much-rails-0.4.3 test/unit/action/render_result_tests.rb
much-rails-0.4.2 test/unit/action/render_result_tests.rb
much-rails-0.4.1 test/unit/action/render_result_tests.rb
much-rails-0.4.0 test/unit/action/render_result_tests.rb
much-rails-0.3.0 test/unit/action/render_result_tests.rb
much-rails-0.2.8 test/unit/action/render_result_tests.rb
much-rails-0.2.7 test/unit/action/render_result_tests.rb
much-rails-0.2.6 test/unit/action/render_result_tests.rb
much-rails-0.2.5 test/unit/action/render_result_tests.rb
much-rails-0.2.4 test/unit/action/render_result_tests.rb
much-rails-0.2.3 test/unit/action/render_result_tests.rb
much-rails-0.2.2 test/unit/action/render_result_tests.rb
much-rails-0.2.1 test/unit/action/render_result_tests.rb
much-rails-0.2.0 test/unit/action/render_result_tests.rb
much-rails-0.1.3 test/unit/action/render_result_tests.rb
much-rails-0.1.2 test/unit/action/render_result_tests.rb
much-rails-0.1.1 test/unit/action/render_result_tests.rb
much-rails-0.1.0 test/unit/action/render_result_tests.rb