Sha256: d5385360d2fad056750d454cdad26224090b93cf00e4bafdab289046e8245d69

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/integration_helper")

RSpec.describe "User visits widgets", type: :request do
  before do
    allow_any_instance_of(InfluxDB::Rails::Configuration).to receive(:ignored_environments).and_return(%w[development])
  end

  describe "in a normal request" do
    it "should result in attempts to write metrics via the client" do
      expect(InfluxDB::Rails.client).to receive(:write_point).exactly(5).times
      get "/widgets"
    end

    context "additional values" do
      it "should result in attempts to write metrics via the client" do
        allow_any_instance_of(ActionDispatch::Request).to receive(:request_id).and_return(:request_id)
        expect(InfluxDB::Rails.client).to receive(:write_point).with(
          "rails", a_hash_including(
                     tags:   a_hash_including(method: "WidgetsController#index", hook: "process_action"),
                     values: a_hash_including(request_id: :request_id, key: :value)
                   )
        )
        get "/widgets"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
influxdb-rails-1.0.0 spec/integration/metrics_spec.rb
influxdb-rails-1.0.0.beta4 spec/integration/metrics_spec.rb