CodingZeal/representable_matchers

View on GitHub
lib/matchers/representable_collection_matcher.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Representable
  module Matchers
    class RepresentableCollectionMatcher < SubMatcher

      def matches?(subject)
        super(subject)
        collection?
      end

      def description
        "only allow representable collection"
      end

      private

      def collection?
        @subject.send(:representable_attrs)[property].options[:collection] == true
      end

      def expectation
        "#{@subject.class} to be a collection"
      end
    end
  end
end