Sha256: f4ea2f09f1db9016fbefd7ed40400fca1c7ae66064df2a93382e01bfab781658

Contents?: true

Size: 1.56 KB

Versions: 27

Compression:

Stored size: 1.56 KB

Contents

require 'spec_helper'
describe Auth0::Api::V2::Logs do
  before :all do
    dummy_instance = DummyClass.new
    dummy_instance.extend(Auth0::Api::V2::Logs)
    @instance = dummy_instance
  end

  context '.logs' do
    it { expect(@instance).to respond_to(:logs) }
    it { expect(@instance).to respond_to(:get_logs) }
    it 'is expected to call /api/v2/logs' do
      expect(@instance).to receive(:get).with(
        '/api/v2/logs',
        q: nil,
        page: nil,
        per_page: nil,
        sort: nil,
        fields: nil,
        include_fields: nil,
        include_totals: nil,
        from: nil,
        take: nil
      )
      expect { @instance.logs }.not_to raise_error
    end
    it 'is expect to rise an error when take is higher than 100' do
      expect { @instance.logs(take: rand(101..2000)) }.to raise_error(
        'The total amount of entries to retrieve should be less than 100'
      )
    end
    it 'is expect to rise an error when per_page is higher than 100' do
      expect { @instance.logs(per_page: rand(101..2000)) }.to raise_error(
        'The total amount of entries per page should be less than 100'
      )
    end
  end

  context '.log' do
    it { expect(@instance).to respond_to(:log) }
    it { expect(@instance).to respond_to(:get_logs_by_id) }
    it 'is expected to call get request to /api/v2/logs/LOG_ID' do
      expect(@instance).to receive(:get).with('/api/v2/logs/LOG_ID')
      expect { @instance.log('LOG_ID') }.not_to raise_error
    end
    it { expect { @instance.log(nil) }.to raise_error('Must supply a valid log_id') }
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
auth0-5.6.1 spec/lib/auth0/api/v2/logs_spec.rb
auth0-5.6.0 spec/lib/auth0/api/v2/logs_spec.rb
auth0-5.5.0 spec/lib/auth0/api/v2/logs_spec.rb
auth0-5.4.0 spec/lib/auth0/api/v2/logs_spec.rb
auth0-5.3.0 spec/lib/auth0/api/v2/logs_spec.rb
auth0-5.2.0 spec/lib/auth0/api/v2/logs_spec.rb
auth0-5.1.2 spec/lib/auth0/api/v2/logs_spec.rb
auth0-5.1.1 spec/lib/auth0/api/v2/logs_spec.rb
auth0-5.1.0 spec/lib/auth0/api/v2/logs_spec.rb
auth0-5.0.1 spec/lib/auth0/api/v2/logs_spec.rb
auth0-5.0.0 spec/lib/auth0/api/v2/logs_spec.rb
auth0-4.17.1 spec/lib/auth0/api/v2/logs_spec.rb
auth0-4.17.0 spec/lib/auth0/api/v2/logs_spec.rb
auth0-4.16.0 spec/lib/auth0/api/v2/logs_spec.rb
auth0-4.15.0 spec/lib/auth0/api/v2/logs_spec.rb
auth0-4.14.0 spec/lib/auth0/api/v2/logs_spec.rb
auth0-4.13.0 spec/lib/auth0/api/v2/logs_spec.rb
auth0-4.12.0 spec/lib/auth0/api/v2/logs_spec.rb
auth0-4.11.0 spec/lib/auth0/api/v2/logs_spec.rb
auth0-4.10.0 spec/lib/auth0/api/v2/logs_spec.rb