Sha256: aed04bddf43e643f4e68ddb29f9c0903f8d2b58982b72db9e92a2773def4ff6b

Contents?: true

Size: 762 Bytes

Versions: 15

Compression:

Stored size: 762 Bytes

Contents

# frozen_string_literal: true
module ActiveMocker
  module DoNothingActiveRecordMethods
    def self.included(base)
      base.extend(ClassMethods)
    end

    module ClassMethods
      def transaction(*)
        yield
      rescue LocalJumpError => err
        raise err
      rescue StandardError => e
        raise e
      end

      def column_names
        attribute_names
      end
    end

    def readonly?
      false
    end

    def errors
      obj = Object.new

      def obj.[](_key)
        []
      end

      def obj.full_messages
        []
      end

      obj
    end

    def valid?
      true
    end

    def marked_for_destruction?
      false
    end

    def destroyed?
      false
    end

    def reload
      self
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
active_mocker-2.6.2 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.6.1.beta2 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.6.1.beta lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.6.0 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.5.4 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.5.3 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.5.2 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.5.1 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.5.1.pre lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.5.0 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.4.4 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.4.3 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.4.2 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.4.1 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.4.0 lib/active_mocker/mock/do_nothing_active_record_methods.rb