Sha256: 9701df8d3182c0bf19f40a4a7b1940945627cbbcbbe0827bc51aadc1ffdf2055

Contents?: true

Size: 1.33 KB

Versions: 5

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe YogiBerra do
  before(:all) do
    @test_yaml = "#{SPEC_FOLDER}/fixtures/test.yml"
  end

  before(:each) do
    YogiBerra::Logger.stub(:log)
  end

  it "should load a yaml file without rails" do
    lambda { YogiBerra::Catcher.load_db_settings(@test_yaml) }.should_not raise_error
    YogiBerra::Catcher.settings.should_not == nil
    YogiBerra::Catcher.settings["project"].should == "test_yogi_project"
  end

  it "should load a yaml file with rails" do
    ENV["YOGI_ENV"] = nil
    load "#{SPEC_FOLDER}/fixtures/rails.rb"
    lambda { YogiBerra::Catcher.load_db_settings }.should_not raise_error
    YogiBerra::Catcher.settings.should_not == nil
    YogiBerra::Catcher.settings["project"].should == "rails_yogi_project"
    Object.send(:remove_const, :Rails)
  end

  it "should grab a connection using the settings file" do
    mock_mongo_client(true)
    connection = nil
    YogiBerra::Catcher.load_db_settings(@test_yaml)
    connection = YogiBerra::Catcher.quick_connection
    connection.should_not == nil
  end

  it "should grab a connection to mongodb" do
    mock_mongo_client
    yaml = nil
    yaml = YogiBerra::Catcher.load_db_settings(@test_yaml)
    db_client = YogiBerra::Catcher.db_client(YogiBerra::Catcher.settings["host"], YogiBerra::Catcher.settings["port"])
    db_client.should_not == nil
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yogi_berra-0.0.10 spec/yogi_berra_catcher_spec.rb
yogi_berra-0.0.9 spec/yogi_berra_catcher_spec.rb
yogi_berra-0.0.8 spec/yogi_berra_catcher_spec.rb
yogi_berra-0.0.6 spec/yogi_berra_catcher_spec.rb
yogi_berra-0.0.5 spec/yogi_berra_catcher_spec.rb