Sha256: 6b306001d7f072b471b51eed5616339439489890a40b194d440415c4b23f7d14

Contents?: true

Size: 1.45 KB

Versions: 6

Compression:

Stored size: 1.45 KB

Contents

describe Frenetic do
  let(:client) { Frenetic.new }
  let(:config) { {
    :url     => 'http://example.org:5447/api',
    :api_key => '1234567890',
    :version => 'v1'
  } }

  before { Frenetic::Configuration.stubs(:new).returns(config) }

  subject { client }

  it { should respond_to(:description) }
  it { should respond_to(:connection) }
  it { should respond_to(:conn) }
  it { should respond_to(:get) }
  it { should respond_to(:put) }
  it { should respond_to(:post) }
  it { should respond_to(:delete) }

  its(:connection) { should be_a(Faraday::Connection) }

  describe "#connection" do
    before do
      faraday_stub = Faraday.new
      Faraday.stubs(:new).returns( faraday_stub )

      client
    end

    subject { client.connection }

    it { should be_a(Faraday::Connection) }

    it "should be created" do
      Faraday.should have_received(:new).with() { |config|
        config.has_key? :url
      }
    end
  end
 
  describe "#description" do
    subject do
      VCR.use_cassette('description_success') do
        client.description
      end
    end

    it { should be_a( Frenetic::HalJson::ResponseWrapper ) }
  end

  describe "#reload!" do
    before do
      VCR.use_cassette('description_success') do
        client.description
      end

      client.reload!
    end

    it "should not have any non-Nil instance variables" do
      client.instance_variables.none? { |s| client.instance_variable_get(s).nil? }.should be_false
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
frenetic-0.0.2.alpha4 spec/lib/frenetic_spec.rb
frenetic-0.0.2.alpha3 spec/lib/frenetic_spec.rb
frenetic-0.0.2.alpha2 spec/lib/frenetic_spec.rb
frenetic-0.0.2.alpha1 spec/lib/frenetic_spec.rb
frenetic-0.0.1.alpha1 spec/lib/frenetic_spec.rb
frenetic-0.0.1 spec/lib/frenetic_spec.rb