lib/matchers/associations.rb in mongoid-rspec-1.9.0 vs lib/matchers/associations.rb in mongoid-rspec-1.10.0
- old
+ new
@@ -10,20 +10,15 @@
BELONGS_TO = Mongoid::Relations::Referenced::In
EMBEDS_MANY = Mongoid::Relations::Embedded::Many
EMBEDS_ONE = Mongoid::Relations::Embedded::One
EMBEDDED_IN = Mongoid::Relations::Embedded::In
-
class HaveAssociationMatcher
def initialize(name, association_type)
@association = {}
@association[:name] = name.to_s
@association[:type] = association_type
- # begin
- # @association[:class] = name.to_s.classify.constantize
- # rescue
- # end
@expectation_message = "#{type_description} #{@association[:name].inspect}"
@expectation_message << " of type #{@association[:class].inspect}" unless @association[:class].nil?
end
def of_type(klass)
@@ -276,13 +271,12 @@
raise "Unknown association type '%s'" % type
end
end
private
-
- def order_way(operator)
- [nil, "ascending", "descending"][operator]
- end
+ def order_way(operator)
+ [nil, "ascending", "descending"][operator]
+ end
end
def embed_one(association_name)
HaveAssociationMatcher.new(association_name, EMBEDS_ONE)
end