2019-10-17 18:29:15 +00:00
|
|
|
require 'rails_helper'
|
2015-08-01 15:20:49 +00:00
|
|
|
|
|
|
|
describe Api::V1::ServersController do
|
|
|
|
before do
|
2015-11-08 09:41:11 +00:00
|
|
|
request.accept = "application/json"
|
2015-08-15 11:50:28 +00:00
|
|
|
end
|
2015-08-01 15:20:49 +00:00
|
|
|
|
2015-11-08 09:41:11 +00:00
|
|
|
describe "#index" do
|
2015-08-01 15:20:49 +00:00
|
|
|
let!(:server) { create :server, :active }
|
|
|
|
let!(:inactive_server) { create :server, :inactive }
|
|
|
|
|
2015-11-08 09:41:11 +00:00
|
|
|
it "returns a list of servers" do
|
2015-08-01 15:20:49 +00:00
|
|
|
get :index
|
|
|
|
expect(response).to be_success
|
2015-11-08 09:41:11 +00:00
|
|
|
expect(json["servers"].length).to eq(1)
|
|
|
|
json_server = json["servers"][0]
|
|
|
|
expect(json_server["id"]).to eq(server.id)
|
2015-08-01 15:20:49 +00:00
|
|
|
end
|
|
|
|
end
|
2015-08-15 11:50:28 +00:00
|
|
|
end
|