spec/conglomerate_spec.rb in conglomerate-0.5.1 vs spec/conglomerate_spec.rb in conglomerate-0.6.0

- old
+ new

@@ -16,12 +16,12 @@ roster_url(item.roster_id) end attribute :team_ids, :rel => :teams, :type => :array do |item| team_url(item.team_ids.join(",")) end - attribute :user_ids, :rel => :users, :type => :array do |item| - user_url(item.user_ids.join(",")) + item_link :users do |item| + users_search_url :object_id => item.id end attribute :is_available link :events do events_url @@ -76,10 +76,13 @@ } allow(context).to receive(:team_url).with("1,2") { "https://example.com/teams/1,2" } allow(context).to receive(:test_url) { "abc" } + allow(context).to receive(:users_search_url).with(:object_id => 1) { + "def" + } end end let(:test_serializer) do ConglomerateTestSerializer.new(object, :context => context).serialize @@ -159,15 +162,15 @@ {"name" => "description", "value" => "Tasty Burgers"}, {"name" => "id", "value" => 1}, {"name" => "event_id", "value" => 2}, {"name" => "roster_id", "value" => nil}, {"name" => "team_ids", "array" => [1,2]}, - {"name" => "user_ids", "array" => []}, {"name" => "is_available", "value" => false} ], "links" => [ {"rel" => "event", "href" => "https://example.com/events/2"}, - {"rel" => "teams", "href" => "https://example.com/teams/1,2"} + {"rel" => "teams", "href" => "https://example.com/teams/1,2"}, + {"rel" => "users", "href" => "def"} ] } ] ) end