Sha256: 2b806d1ccaeb20a659f7afeb43e0dfd2e3f4d1059cda2c8a5f9f8ee7efbe5a04
Contents?: true
Size: 866 Bytes
Versions: 7
Compression:
Stored size: 866 Bytes
Contents
# frozen_string_literal: true require 'spec_helper' RSpec.describe Addresses::CitiesController, type: :request do let!(:state) { create :state } let!(:city) { create :city, state: state } describe "GET /cities" do before { get '/addresses/cities', params: { state_id: state.id, format: "json" } } it "should return an list of cities" do json = JSON.parse(response.body) expect(response.status).to be(200) expect(json.size).to eq(1) expect(json[0]["name"]).to eq(city.name) end end describe "GET /cities/:id" do before { get "/addresses/cities/#{city.id}", params: { format: "json" } } it "should return a specific city" do json = JSON.parse(response.body) expect(response.status).to be(200) expect(json["id"]).to eq(city.id) expect(json["name"]).to eq(city.name) end end end
Version data entries
7 entries across 7 versions & 1 rubygems