Sha256: 67c93d0bd83e97c4af14ed5bf8ad3e7a10c18e6e232e5df10689b9b98a79da83

Contents?: true

Size: 1.27 KB

Versions: 23

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe Ridley::Client do
  it_behaves_like "a Ridley Resource", Ridley::Client

  let(:connection) { double('connection') }

  describe "ClassMethods" do
    subject { Ridley::Client }

    describe "::regenerate_key" do
      let(:client) { double('client', name: "ridley-test") }

      it "finds the given client and regenerates it's key" do
        client.should_receive(:regenerate_key)
        subject.should_receive(:find!).with(connection, "ridley-test").and_return(client)
        
        subject.regenerate_key(connection, "ridley-test")
      end

      it "returns the updated client" do
        client.should_receive(:regenerate_key)
        subject.should_receive(:find!).with(connection, "ridley-test").and_return(client)

        subject.regenerate_key(connection, "ridley-test").should eql(client)
      end
    end
  end

  subject do
    Ridley::Client.new(connection, name: "ridley-test", admin: false)
  end

  describe "#regenerate_key" do
    it "returns true if successful" do
      subject.should_receive(:save).and_return(true)

      subject.regenerate_key.should be_true
    end

    it "returns false if not successful" do
      subject.should_receive(:save).and_return(false)

      subject.regenerate_key.should be_false
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
ridley-0.7.0.beta spec/unit/ridley/resources/client_spec.rb
ridley-0.6.3 spec/unit/ridley/resources/client_spec.rb
ridley-0.6.2 spec/unit/ridley/resources/client_spec.rb
ridley-0.6.1 spec/unit/ridley/resources/client_spec.rb
ridley-0.6.0 spec/unit/ridley/resources/client_spec.rb
ridley-0.5.2 spec/unit/ridley/resources/client_spec.rb
ridley-0.5.1 spec/unit/ridley/resources/client_spec.rb
ridley-0.5.0 spec/unit/ridley/resources/client_spec.rb
ridley-0.4.1 spec/unit/ridley/resources/client_spec.rb
ridley-0.4.0 spec/unit/ridley/resources/client_spec.rb
ridley-0.3.2 spec/unit/ridley/resources/client_spec.rb
ridley-0.3.1 spec/unit/ridley/resources/client_spec.rb
ridley-0.3.0 spec/unit/ridley/resources/client_spec.rb
ridley-0.2.2 spec/unit/ridley/resources/client_spec.rb
ridley-0.2.1 spec/unit/ridley/resources/client_spec.rb
ridley-0.2.0 spec/unit/ridley/resources/client_spec.rb
ridley-0.1.0 spec/unit/ridley/resources/client_spec.rb
ridley-0.0.6 spec/unit/ridley/resources/client_spec.rb
ridley-0.0.5 spec/unit/ridley/resources/client_spec.rb
ridley-0.0.4 spec/unit/ridley/resources/client_spec.rb