Created
July 23, 2014 16:06
-
-
Save danhunter/9ed626ce9c7ecbfe01e1 to your computer and use it in GitHub Desktop.
refactored spec attempt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
['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