Skip to content

Instantly share code, notes, and snippets.

@GiancarlosIO
Last active June 15, 2017 23:57
Show Gist options
  • Save GiancarlosIO/eb87a8b92440a260a009f1749af92cfc to your computer and use it in GitHub Desktop.
Save GiancarlosIO/eb87a8b92440a260a009f1749af92cfc to your computer and use it in GitHub Desktop.
# my_api/rspec/requests/users_spec.rb
require 'rails_helper'
RSpec.describe Api::V1::UsersController, type: :request do
describe "GET /users" do
before :each do
FactoryGirl.create_list(:users, 1)
get "/api/v1/users"
end
it { have_http_status(200) }
it 'show all users' do
json = JSON.parse(response.body)
expect(json.length).to eq(User.count)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment