Sha256: 6e4228141c313f111e9ee41ea0155428a01d97a7ea1a7b73b72b1be66e30c335

Contents?: true

Size: 1.06 KB

Versions: 18

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

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

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

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

  class InitTests < UnitTests
    desc "when init"
    subject do
      unit_class.new(
        :do_something,
        "VALUE",
        other_value: "OTHER VALUE",
      )
    end

    let(:controller1){ FakeController.new }

    should have_readers :command_name, :command_args

    should "know its attributes" do
      assert_that(subject.command_name).equals(:do_something)
      assert_that(subject.command_args)
        .equals(["VALUE", { other_value: "OTHER VALUE" }])

      assert_that(controller1.instance_exec(subject, &subject.execute_block))
        .equals(value: "VALUE", other_value: "OTHER VALUE")
    end
  end

  class FakeController
    def do_something(value, other_value:)
      { value: value, other_value: other_value }
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

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