Sha256: d8793d3be08b6dae763f882a5bf0406cf976bb8357504ce3d1790236f652bc0e

Contents?: true

Size: 1.05 KB

Versions: 8

Compression:

Stored size: 1.05 KB

Contents

require File.expand_path("../spec_helper", __FILE__)

describe "Saved Queries" do
  let(:project_id) { ENV["KEEN_PROJECT_ID"] }
  let(:master_key) { ENV["KEEN_MASTER_KEY"] }
  let(:read_key) { ENV["KEEN_READ_KEY"] }
  let(:client) { Keen::Client.new(project_id: project_id, master_key: master_key, read_key: read_key) }

  describe "#all" do
    it "gets all saved_queries" do
      expect(client.saved_queries.all).to be_instance_of(Array)
    end
  end

  describe "#get" do
    it "gets a single saved query" do
      all_queries = client.saved_queries.all

      single_saved_query = client.saved_queries.get(all_queries.first[:query_name])

      expect(single_saved_query[:query_name]).to eq(all_queries.first[:query_name])
      expect(single_saved_query[:results]).to be_nil
    end
  end

  describe "#results" do
    it "gets a single saved query" do
      all_queries = client.saved_queries.all

      single_saved_query = client.saved_queries.get(all_queries.last[:query_name], results: true)

      expect(single_saved_query[:result]).not_to be_nil
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
keen-1.1.1 spec/integration/saved_query_spec.rb
keen-1.1.0 spec/integration/saved_query_spec.rb
keen-1.0.0 spec/integration/saved_query_spec.rb
keen-0.9.10 spec/integration/saved_query_spec.rb
keen-0.9.9 spec/integration/saved_query_spec.rb
keen-0.9.8 spec/integration/saved_query_spec.rb
keen-0.9.7 spec/integration/saved_query_spec.rb
keen-0.9.6 spec/integration/saved_query_spec.rb