Sha256: cca716c2f94b839d2cc4fcfad217d2ba88c8aaf7826e54927654023d0dd29534

Contents?: true

Size: 856 Bytes

Versions: 3

Compression:

Stored size: 856 Bytes

Contents

require 'test_helper'

module PushType
  class TrashableTest < ActiveSupport::TestCase

    describe 'query scopes' do
      it { PushType::Node.respond_to?(:trashed).must_equal true }
      it { PushType::Node.respond_to?(:not_trash).must_equal true }
    end

    describe '#trashed?' do
      describe 'when not trash' do
        let(:page) { FactoryBot.create :node }
        it { page.trashed?.must_equal false }
        describe '#trash!' do
          before { page.trash! }
          it { page.trashed?.must_equal true }
        end
      end

      describe 'when trash' do
        let(:page) { FactoryBot.create :node, deleted_at: Time.zone.now }
        it { page.trashed?.must_equal true }
        describe '#restore!' do
          before { page.restore! }
          it { page.trashed?.must_equal false }
        end
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
push_type_core-0.12.1 test/models/concerns/push_type/trashable_test.rb
push_type_core-0.12.0 test/models/concerns/push_type/trashable_test.rb
push_type_core-0.12.0.beta.1 test/models/concerns/push_type/trashable_test.rb