Sha256: 2e66f7547bfba48024dccdb59485042604bcc670237eaf26f5d6359f08e52edd

Contents?: true

Size: 1.84 KB

Versions: 2

Compression:

Stored size: 1.84 KB

Contents

# Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.
require File.expand_path("../spec_helper", File.dirname(__FILE__))

describe Ripple do
  it "should have a client" do
    Ripple.client.should be_kind_of(Riak::Client)
  end

  it "should have a unique client per thread" do
    client = Ripple.client
    th = Thread.new { Ripple.client.should_not == client }
    th.join
  end

  it "should be configurable" do
    Ripple.should respond_to(:config)
  end

  it "should allow setting the client manually" do
    Ripple.should respond_to(:client=)
    client = Riak::Client.new(:port => 9000)
    Ripple.client = client
    Ripple.client.should == client
  end
  
  it "should reset the client when the configuration changes" do
    c = Ripple.client
    Ripple.config = {:port => 9000}
    Ripple.client.should_not == c
    Ripple.client.port.should == 9000
  end
  
  it "should raise No Such File or Directory when given a bad configuration file" do
    lambda { Ripple.load_config('not-here') }.should raise_error(Errno::ENOENT)
  end
  
  it "should apply the configuration under the ripple key" do
    Ripple.load_config(File.join(File.dirname(__FILE__), '..', 'fixtures', 'config.yml'))
    Ripple.client.port.should == 9000
    Ripple.client.host.should == 'localhost'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ripple-0.7.1 spec/ripple/ripple_spec.rb
ripple-0.7.0 spec/ripple/ripple_spec.rb