environment_spec.rb 764 B

123456789101112131415161718192021222324252627282930313233
  1. require 'api_client'
  2. RSpec.describe 'Environment' do
  3. before(:each) do
  4. @host = ENV.fetch('ESPMH_HOSTNAME')
  5. @client = ApiClient.new(ENV.fetch('ESPMH_HOSTNAME'), ENV.fetch('ESPMH_TEST_DEVICE_ID_BASE'))
  6. end
  7. context 'environment' do
  8. it 'should have a host defined' do
  9. expect(@host).to_not be_nil
  10. end
  11. it 'should respond to /about' do
  12. response = @client.get('/about')
  13. expect(response).to_not be_nil
  14. expect(response.keys).to include('version')
  15. end
  16. end
  17. context 'client' do
  18. it 'should return IDs' do
  19. id = @client.generate_id
  20. expect(@client.generate_id).to equal(id + 1)
  21. end
  22. end
  23. it 'needs to have a settings.json file' do
  24. expect(File.exists?('settings.json')).to be(true)
  25. end
  26. end