Sha256: f101ba15af85ce829a100c4105b8cd4d961a1741302cf063c546f37bbbc50c07

Contents?: true

Size: 947 Bytes

Versions: 2

Compression:

Stored size: 947 Bytes

Contents

module PrivateExtension # :nodoc:
  module PrivateMessages # :nodoc:
    module Shoulda # :nodoc:
      module Matchers # :nodoc:

        def have_private_messages
          HavePrivateMessagesMatcher.new
        end

        class HavePrivateMessagesMatcher # :nodoc:

          def matches? subject
            @subject = subject
            @subject = @subject.class unless Class === @subject
            included?
          end

          def failure_message
            "Should have 'has_private_messages' method"
          end

          def negative_failure_message
            "Should not have 'has_private_messages' method"
          end

          def description
            "have private messages"
          end

          protected

          def included?
            @subject.ancestors.include?(PrivateExtension::PrivateMessages::HasPrivateMessagesExtensions::InstanceMethods)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
user_private_messages-1.0.1 lib/user_private_messages/matchers/have_private_messages_matcher.rb
user_private_messages-1.0.0 lib/private_messages/matchers/have_private_messages_matcher.rb