2019-10-17 18:29:15 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
module Api
|
|
|
|
module V1
|
|
|
|
end
|
|
|
|
end
|
2015-08-01 15:34:01 +00:00
|
|
|
|
|
|
|
describe Api::V1::MapsController do
|
|
|
|
before do
|
2015-11-08 09:41:11 +00:00
|
|
|
request.accept = "application/json"
|
2020-03-23 02:10:31 +00:00
|
|
|
create_list :map, 20
|
2015-08-15 11:50:28 +00:00
|
|
|
end
|
2015-08-01 15:34:01 +00:00
|
|
|
|
2015-08-01 15:34:01 +00:00
|
|
|
describe '#index' do
|
2020-03-23 02:10:31 +00:00
|
|
|
it "return N maps" do
|
2015-08-01 15:34:01 +00:00
|
|
|
get :index
|
2020-03-23 02:10:31 +00:00
|
|
|
expect(response).to have_http_status(:success)
|
|
|
|
expect(json["maps"].length).to eq(20)
|
2015-08-01 15:34:01 +00:00
|
|
|
end
|
2020-03-23 02:10:31 +00:00
|
|
|
|
2020-03-23 03:15:27 +00:00
|
|
|
# FIXME. Find the right map id
|
|
|
|
it "return right map id" do
|
|
|
|
skip
|
|
|
|
map = create(:map)
|
|
|
|
get :index
|
|
|
|
expect(json["maps"].last["id"]).to eq(map.id)
|
|
|
|
end
|
2015-08-01 15:34:01 +00:00
|
|
|
end
|
2015-08-15 11:50:28 +00:00
|
|
|
end
|