Sha256: 630aaa4951fd4ab24a924ca93f22a43cfeda01a67ff42252641b5ba46de9f91e

Contents?: true

Size: 811 Bytes

Versions: 8

Compression:

Stored size: 811 Bytes

Contents

require 'spec_helper'

describe AppMonit::Query do
  subject { AppMonit::Query }

  before do
    AppMonit::Config.api_key   = 'MYAPIKEY'
    AppMonit::Config.end_point = 'http://api.appmon.it'
    AppMonit::Config.env       = nil
  end

  %w(count count_unique minimum maximum average sum funnel).each do |method_name|
    describe method_name do
      it 'gets the results with the given params' do
        stub_request(:get, /api.appmon.it\/v1\/queries\/#{method_name}/).to_return(code: '200', body: {result: '0'}.to_json)

        params = { valid: 'params' }
        subject.send(method_name, 'collection_name', params)

        params[:event_collection] = 'collection_name'

        assert_requested(:get, /api.appmon.it\/v1\/queries\/#{method_name}\?query=#{params.to_json}/)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
app_monit-0.0.8 spec/app_monit/query_spec.rb
app_monit-0.0.7 spec/app_monit/query_spec.rb
app_monit-0.0.6 spec/app_monit/query_spec.rb
app_monit-0.0.5 spec/app_monit/query_spec.rb
app_monit-0.0.4 spec/app_monit/query_spec.rb
app_monit-0.0.3 spec/app_monit/query_spec.rb
app_monit-0.0.2 spec/app_monit/query_spec.rb
app_monit-0.0.1 spec/app_monit/query_spec.rb