Sha256: e7d51dc9f907ae18851af4093492d3536ce3346ded07079ce38e0dbbeffd3bc5

Contents?: true

Size: 1.73 KB

Versions: 13

Compression:

Stored size: 1.73 KB

Contents

require "spec_helper"
describe Auth0::Api::V1::Logs do
  before :all do
    dummy_instance = DummyClass.new
    dummy_instance.extend(Auth0::Api::V1::Logs)
    dummy_instance.extend(Auth0::Mixins::Initializer)
    @instance = dummy_instance
  end

  context ".logs or .search_logs" do
    it {expect(@instance).to respond_to(:logs)}
    it {expect(@instance).to respond_to(:search_logs)}
    it "should call path with all provided params per_page" do
      expect(@instance).to receive(:get).with("/api/logs?per_page=500")
      expect{@instance.logs("per_page" => 500)}.not_to raise_error
    end
    it "should call path with all provided params per_page, page" do
      expect(@instance).to receive(:get).with("/api/logs?per_page=500&page=3")
      expect{@instance.logs("per_page" => 500, page: 3)}.not_to raise_error
    end

    it "should raise warn if any garbage params are passed" do
      error_message = "random_stuff is not in acceptable params list: [:take, :from, :search_criteria, :page, :per_page, :sort, :fields, :exclude_fields]"
      expect(@instance).to receive(:warn).with(error_message)
      @instance.logs("per_page" => 500, page: 3, random_stuff:7 )
    end
  end

  context ".log" do
    it {expect(@instance).to respond_to :log}
    it "is expected to get '/api/logs/te st'" do
      expect(@instance).to receive(:get).with("/api/logs/te st")
      expect{@instance.log("te st")}.not_to raise_error
    end
  end

  context ".user_logs" do
    it {expect(@instance).to respond_to(:user_logs)}
    it "is expected to get /api/users/#user_id/logs" do
      expect(@instance).to receive(:get).with("/api/users/auth0|test test/logs?page=0&per_page=50")
      expect{@instance.user_logs("auth0|test test")}.not_to raise_error
    end
  end


end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
auth0-3.6.1 spec/lib/auth0/api/v1/logs_spec.rb
auth0-3.6.0 spec/lib/auth0/api/v1/logs_spec.rb
auth0-3.5.0 spec/lib/auth0/api/v1/logs_spec.rb
auth0-3.4.0 spec/lib/auth0/api/v1/logs_spec.rb
auth0-3.3.0 spec/lib/auth0/api/v1/logs_spec.rb
auth0-3.2.0 spec/lib/auth0/api/v1/logs_spec.rb
auth0-3.1.2 spec/lib/auth0/api/v1/logs_spec.rb
auth0-3.1.1 spec/lib/auth0/api/v1/logs_spec.rb
auth0-3.1.0 spec/lib/auth0/api/v1/logs_spec.rb
auth0-3.0.0 spec/lib/auth0/api/v1/logs_spec.rb
auth0-ruby-0.10 spec/lib/auth0/api/v1/logs_spec.rb
auth0-ruby-0.9.1 spec/lib/auth0/api/v1/logs_spec.rb
auth0-ruby-0.9 spec/lib/auth0/api/v1/logs_spec.rb