active_model_serializers-matchers icon indicating copy to clipboard operation
active_model_serializers-matchers copied to clipboard

Update to work with latest version of the gem

Open alexspeller opened this issue 13 years ago • 0 comments

Some minor changes to how associations are tested, and allow specification of attribute aliases, e.g.

  it "should match attributes with keys" do
    serializer = Class.new ActiveModel::Serializer do
      attribute :foo, :key => :foo_name
    end

    serializer.should_not have_attribute :bar
    serializer.should have_attribute :foo
    serializer.should have_attribute(:foo).as(:foo_name)
    serializer.should_not have_attribute(:foo).as(:another_name)
  end

alexspeller avatar Sep 10 '12 14:09 alexspeller