add zone test-rspec
This commit is contained in:
0
spec/requests/api/restaurant/seat_tables.rb
Normal file
0
spec/requests/api/restaurant/seat_tables.rb
Normal file
25
spec/requests/api/restaurant/zones.rb
Normal file
25
spec/requests/api/restaurant/zones.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Zone API', type: :request do
|
||||
# initialize test data
|
||||
let!(:zone) { create_list(:zone, 10) }
|
||||
let(:zone_id) { zones.first.id }
|
||||
|
||||
# Test suite for GET /todos
|
||||
describe 'GET /api/restaurant/zones' do
|
||||
# make HTTP get request before each example
|
||||
before { get '/api/restaurant/zones' }
|
||||
|
||||
it 'returns zones' do
|
||||
# Note `json` is a custom helper to parse JSON responses
|
||||
expect(json).not_to be_empty
|
||||
expect(json.size).to eq(10)
|
||||
end
|
||||
|
||||
it 'returns status code 200' do
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user