Sha256: d9a52e607d46f9c62c2303c28563427ac78ed9c5c57bf8a02fef2fc6302b4f61

Contents?: true

Size: 639 Bytes

Versions: 2

Compression:

Stored size: 639 Bytes

Contents

require "warp/action_matchers/matcher"
require "warp/instrument"

module Warp
  module ActionMatchers
    class UpdateMatcher < Warp::ActionMatchers::Matcher
      def description
        "update a #{model_name}"
      end

      def failure_message
        "expected a #{model_name} to be updated"
      end

      def failure_message_when_negated
        "expected no #{model_name} to be updated"
      end

      private

      def instrument_method
        ActiveRecord::Base.private_method_defined?(:_update_record) ? :_update_record : :update
      end
    end

    def update(model)
      UpdateMatcher.new(model)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
warp-1.5.0 lib/warp/action_matchers/update_matcher.rb
warp-1.4.0 lib/warp/action_matchers/update_matcher.rb