Sha256: 34c6c33db5a444f700b8a933b44d7db8727973a8f05944b6a488c4ade216dc26

Contents?: true

Size: 1.47 KB

Versions: 10

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'

describe Lionel::TrelloAuthentication do
  it {
    subject.trello_key_url.should eq("https://trello.com/1/appKey/generate")
  }
  it {
    subject.trello_token_url("TOKEN").should eq("https://trello.com/1/authorize?key=TOKEN&name=LionelRichie&response_type=token&scope=read,write,account&expiration=never")
  }
  it { subject.app_name.should eq("LionelRichie") }

  describe "configuration" do
    before(:each) do
      subject.trello_key = "TRELLO_KEY"
      subject.trello_token = "TRELLO_TOKEN"
    end

    it {
      subject.data.should eq({
        trello_key: "TRELLO_KEY",
        trello_token: "TRELLO_TOKEN"
      })
    }

    it "can onfigure the Trello api" do
      subject.configure
      Trello.auth_policy.developer_public_key.should eq("TRELLO_KEY")
      Trello.auth_policy.member_token.should eq("TRELLO_TOKEN")
    end

    it "can save the configuration data" do
      subject.configuration.should_receive(:save).with(subject.data)
      subject.save_configuration
    end

    it { subject.should be_configured }

    context "not configured" do
      before do
        subject.configuration.stub(trello_key: nil, trello_token: nil)
      end

      it { subject.trello_key = nil;
            subject.should_not be_configured }
      it { subject.trello_token = nil;
            subject.should_not be_configured }
      it { subject.trello_key = nil;
            subject.trello_token = nil;
            subject.should_not be_configured }
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
lionel_richie-0.3.1 spec/lib/lionel/trello_authentication_spec.rb
lionel_richie-0.3.0 spec/lib/lionel/trello_authentication_spec.rb
lionel_richie-0.2.4 spec/lib/lionel/trello_authentication_spec.rb
lionel_richie-0.2.3.1 spec/lib/lionel/trello_authentication_spec.rb
lionel_richie-0.2.3 spec/lib/lionel/trello_authentication_spec.rb
lionel_richie-0.2.1 spec/lib/lionel/trello_authentication_spec.rb
lionel_richie-0.2.0 spec/lib/lionel/trello_authentication_spec.rb
lionel_richie-0.1.5.1 spec/lib/lionel/trello_authentication_spec.rb
lionel_richie-0.1.5 spec/lib/lionel/trello_authentication_spec.rb
lionel_richie-0.1.4 spec/lib/lionel/trello_authentication_spec.rb