Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
derailed committed Apr 16, 2013
1 parent 54e5d02 commit c18f798
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 65 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.rvmrc
coverage
fred
pkg
12 changes: 1 addition & 11 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,4 @@ RSpec::Core::RakeTask.new(:spec) do |t|
end

task :default => 'spec'
task 'gem:release' => 'spec'

# BOZO !!
# def ensure_in_path( *args )
# args.each do |path|
# path = File.expand_path(path)
# $:.unshift(path) if test(?d, path) and not $:.include?(path)
# end
# end
#
# ensure_in_path 'lib'
task 'gem:release' => 'spec'
10 changes: 1 addition & 9 deletions lib/mongo3.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
require 'map'

module Mongo3

module Mongo3
# :stopdoc:
VERSION = '0.1.6' unless defined? Mongo3::VERSION
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR unless defined? Mongo3::LIBPATH
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR unless defined? Mongo3::PATH
# :startdoc:

# Returns the version string for the library.
#
def self.version
VERSION
end

# Returns the library path for the module. If any arguments are given,
# they will be joined to the end of the libray path using
# <tt>File.join</tt>.
Expand Down
3 changes: 3 additions & 0 deletions lib/mongo3/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Mongo3
VERSION = "0.1.6"
end
4 changes: 2 additions & 2 deletions mongo3.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "mongo3"
require "mongo3/version"

Gem::Specification.new do |s|
s.name = 'mongo3'
Expand All @@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.authors = ["Fernand Galiana"]
s.email = ["[email protected]"]
s.homepage = 'http://www.mongo3.com'
s.summary = 'Rule your mongoDB clusters'
s.summary = 'Rule your mongoDB clusters!'
s.description = 'Console to administer MongoDB'
s.rubyforge_project = "mongo3"
s.files = `git ls-files`.split("\n")
Expand Down
66 changes: 32 additions & 34 deletions spec/mongo3/zone_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,37 +33,35 @@
end
end

describe "configs" do
before( :all ) do
@crapola = Mongo3::Zone.new( File.join(File.dirname(__FILE__), %w[.. configs crap.yml]) )
end

it "should raise an error on bogus yml" do
lambda {
con = Mongo3::Zone.new( File.join(File.dirname(__FILE__), %w[.. configs hosed.yml]) )
con.send( :config )
}.should raise_error( /Unable to grok yaml landscape file/ )
end

it "should crap out if the zone host is missing correctly" do
lambda {
@crapola.send( :connect_for, "home|bozo" )
}.should raise_error( /Unable to find `host/ )
end

it "should crap out if the zone port is missing correctly" do
lambda {
@crapola.send( :connect_for, "home|blee" )
}.should raise_error( /Unable to find `port/ )
end

it "should crap out if the zone is not correctly configured" do
lambda {
@crapola.send( :connect_for, "home|nowhere" )
}.should raise_error( /MongoDB connection failed for `funky_town/ )
end

end

end

# describe "configs" do
# before( :all ) do
# @crapola = Mongo3::Zone.new( File.join(File.dirname(__FILE__), %w[.. configs crap.yml]) )
# end
#
# it "should raise an error on bogus yml" do
# lambda {
# con = Mongo3::Zone.new( File.join(File.dirname(__FILE__), %w[.. configs hosed.yml]) )
# con.send( :config )
# }.should raise_error( /Unable to grok yaml landscape file/ )
# end
#
# it "should crap out if the zone host is missing correctly" do
# lambda {
# @crapola.send( :connect_for, "home|bozo" )
# }.should raise_error( /Unable to find `host/ )
# end
#
# it "should crap out if the zone port is missing correctly" do
# lambda {
# @crapola.send( :connect_for, "home|blee" )
# }.should raise_error( /Unable to find `port/ )
# end
#
# it "should crap out if the zone is not correctly configured" do
# lambda {
# @crapola.send( :connect_for, "home|nowhere" )
# }.should raise_error( /MongoDB connection failed for `funky_town/ )
# end
#
# end
end
4 changes: 0 additions & 4 deletions spec/mongo3_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
@root = ::File.expand_path( ::File.join(::File.dirname(__FILE__), ".." ) )
end

it "is versioned" do
Mongo3.version.should =~ /\d+\.\d+\.\d+/
end

it "generates a correct path relative to root" do
Mongo3.path( "mongo3.rb" ).should == ::File.join(@root, "mongo3.rb" )
end
Expand Down
7 changes: 2 additions & 5 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
require 'mongo3'
require 'simplecov'

if ENV['COV']
SimpleCov.start do
add_filter "spec/"
end
end

# gem 'agnostic-will_paginate'
# require 'will_paginate/collection'
#
# require File.expand_path( File.join( File.dirname(__FILE__), %w[.. lib mongo3] ) )
require 'mongo3'

RSpec.configure do |config|
begin
Expand Down

0 comments on commit c18f798

Please sign in to comment.