Sha256: 52406bf5f2de69b8dc0f3ebbe60c5365bee5659c02cc32f875f348c7653881c4

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

require "spec_helper"

describe Bugsnag::Api::Client::Stability do
  before do
    @client = auth_token_client
    @project_id = test_bugsnag_project_id

    Bugsnag::Api.reset!
  end

  describe ".stability_trend", :vcr do
    it "gets the stability trend" do
      stability_trend = @client.stability_trend(@project_id)

      expect(stability_trend.project_id).to eq(@project_id)
      expect(stability_trend.release_stage_name).not_to be_nil
      expect(stability_trend.timeline_points).to be_an_instance_of(Array)

      # convert each "Sawyer::Resource" to a hash so we can use the "have_key" matcher
      timeline_points = stability_trend.timeline_points.map(&:to_h)

      expect(timeline_points).to all have_key(:bucket_start)
      expect(timeline_points).to all have_key(:bucket_end)
      expect(timeline_points).to all have_key(:total_sessions_count)
      expect(timeline_points).to all have_key(:unhandled_sessions_count)
      expect(timeline_points).to all have_key(:users_seen)
      expect(timeline_points).to all have_key(:users_with_unhandled)

      assert_requested(:get, bugsnag_url("/projects/#{@project_id}/stability_trend"))
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bugsnag-api-3.0.0 spec/bugsnag/api/client/stability_spec.rb
bugsnag-api-2.1.1 spec/bugsnag/api/client/stability_spec.rb
bugsnag-api-2.1.0 spec/bugsnag/api/client/stability_spec.rb