Sha256: 3f7ecfd786050de1eb6ec05290139ccfd4708256755a5540115112bdddb11ca0

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

RSpec.describe NgrokAPI::Models::Credential do
  before(:each) do
    @client = class_double("CredentialsClient")
    @credential = NgrokAPI::Models::Credential.new(client: @client, result: credential_result)
  end

  describe "#==" do
    it "is equal if the results are the same" do
      other = NgrokAPI::Models::Credential.new(client: @client, result: credential_result)
      expect(@credential == other).to eq true
    end
  end

  describe "#to_s" do
    it "stringifies as result.to_s" do
      expect(@credential.to_s).to eq credential_result.to_s
    end
  end

  describe "#delete" do
    it "calls delete on the client" do
      expect(@credential.client).to receive(:delete)
      @credential.delete
    end
  end

  describe "#update" do
    it "calls update on the client" do
      new_description = 'New description'
      new_metadata = 'New metadata'
      new_acl = 'New acl'
      expect(@credential.client).to receive(:update)
      @credential.update(
        description: new_description,
        metadata: new_metadata,
        acl: new_acl
      )
      expect(@credential.description).to eq new_description
      expect(@credential.metadata).to eq new_metadata
      expect(@credential.acl).to eq new_acl
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ngrok-api-0.18.0 spec/ngrokapi/models/credential_spec.rb
ngrok-api-0.17.0 spec/ngrokapi/models/credential_spec.rb
ngrok-api-0.16.0 spec/ngrokapi/models/credential_spec.rb
ngrok-api-0.15.0 spec/ngrokapi/models/credential_spec.rb
ngrok-api-0.14.0 spec/ngrokapi/models/credential_spec.rb
ngrok-api-0.12.0 spec/ngrokapi/models/credential_spec.rb