Skip to content

Instantly share code, notes, and snippets.

@danhunter
Created July 23, 2014 16:06
Show Gist options
  • Save danhunter/9ed626ce9c7ecbfe01e1 to your computer and use it in GitHub Desktop.
Save danhunter/9ed626ce9c7ecbfe01e1 to your computer and use it in GitHub Desktop.
refactored spec attempt
['addresses', 'orders'].each do |includable|
describe "includes #{includable}" do
let!(:association) { create(includable.singularize, user: user) }
it "GET self" do
get "/api/v2/users/#{user.id}", {'include' => includable}, headers || {}
expect(json['user']).to include(includable)
(json[includable][0]).each do |k, v|
expect(v).to eq(association[k])
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment