Sha256: d56ad7ec7508a82290e857ba15ecfaaa36fdf89808854f015e0e9b54f36a6f1b

Contents?: true

Size: 759 Bytes

Versions: 16

Compression:

Stored size: 759 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

16 entries across 16 versions & 1 rubygems

Version Path
active_mocker-2.4.0.pre5 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.3.4 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.4.0.pre4 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.4.0.pre3 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.4.0.pre2 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.4.0.pre1 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.3.3 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.3.2 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.3.1 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.3.0 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.2.5 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.2.4 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.2.3 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.2.2 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.2.1 lib/active_mocker/mock/do_nothing_active_record_methods.rb
active_mocker-2.2.0 lib/active_mocker/mock/do_nothing_active_record_methods.rb