Sha256: 139981a1d410b15537949951a7ab8dc527510c26f599f6d4f3cf846183b9eeb4

Contents?: true

Size: 989 Bytes

Versions: 14

Compression:

Stored size: 989 Bytes

Contents

# frozen_string_literal: true

require "assert"
require "much-rails/records/always_destroyable"

module MuchRails::Records::AlwaysDestroyable
  class UnitTests < Assert::Context
    desc "MuchRails::Records::AlwaysDestroyable"
    subject{ unit_class }

    let(:unit_class){ MuchRails::Records::AlwaysDestroyable }

    should "include MuchRails::Mixin" do
      assert_that(subject).includes(MuchRails::Mixin)
    end
  end

  class ReceiverTests < UnitTests
    desc "receiver"
    subject{ receiver_class.new }

    let(:receiver_class) do
      Class.new do
        def destroy(*)
          true
        end

        include MuchRails::Records::AlwaysDestroyable
      end
    end

    should "enable destroying a record" do
      assert_that(subject.destruction_error_messages).equals([])

      assert_that(subject.destroy).is_true

      # won't raise MuchRails::Records::DestructionInvalid
      subject.destroy!

      assert_that(subject.destroyable?).is_true
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
much-rails-0.4.3 test/unit/records/always_destroyable_tests.rb
much-rails-0.4.2 test/unit/records/always_destroyable_tests.rb
much-rails-0.4.1 test/unit/records/always_destroyable_tests.rb
much-rails-0.4.0 test/unit/records/always_destroyable_tests.rb
much-rails-0.3.0 test/unit/records/always_destroyable_tests.rb
much-rails-0.2.8 test/unit/records/always_destroyable_tests.rb
much-rails-0.2.7 test/unit/records/always_destroyable_tests.rb
much-rails-0.2.6 test/unit/records/always_destroyable_tests.rb
much-rails-0.2.5 test/unit/records/always_destroyable_tests.rb
much-rails-0.2.4 test/unit/records/always_destroyable_tests.rb
much-rails-0.2.3 test/unit/records/always_destroyable_tests.rb
much-rails-0.2.2 test/unit/records/always_destroyable_tests.rb
much-rails-0.2.1 test/unit/records/always_destroyable_tests.rb
much-rails-0.2.0 test/unit/records/always_destroyable_tests.rb