metamaps--metamaps/spec/controllers/explore_controller_spec.rb

24 lines
562 B
Ruby
Raw Normal View History

2016-09-24 06:35:23 +00:00
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe ExploreController, type: :controller do
before :each do
sign_in create(:user)
end
describe 'GET explore/active' do
context 'always returns an array' do
it 'with 0 records' do
Map.delete_all
get :active, format: :json
expect(JSON.parse(response.body)).to eq []
end
it 'with 1 record' do
map = create(:map)
get :active, format: :json
expect(JSON.parse(response.body).class).to be Array
end
end
end
end