Skip to content

Commit

Permalink
Merge pull request #56 from npauzenga/bugs/user-controller-specs-incl…
Browse files Browse the repository at this point in the history
…ude-serializer

Refactored UsersController#show test to use UserSerializer
  • Loading branch information
npauzenga committed Jan 11, 2016
2 parents 8ebec8a + 2f1b360 commit 0eab0ff
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spec/controllers/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@
end

context "when succesful" do
let(:serializer) { UserSerializer.new(user) }

let(:serialization) do
ActiveModel::Serializer::Adapter.create(serializer)
end

it "calls the ShowUser interactor" do
expect(ShowUser).to receive(:call)
get :show, params
Expand All @@ -109,7 +115,7 @@

it "render the user as JSON" do
get :show, params
expect(response.body).to eq(user.to_json)
expect(serialization.to_json).to eq(response.body)
end
end

Expand Down

0 comments on commit 0eab0ff

Please sign in to comment.