This repository has been archived by the owner on Jan 9, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
run "bundle exec rspec jmongo_spec.rb" for failing spec demonstrating…
… the error
- Loading branch information
1 parent
a109fcd
commit fb92815
Showing
6 changed files
with
75 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
rvm jruby-1.6.3@jmongo --create | ||
export JRUBY_OPTS="--1.9" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
source :rubygems | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
jmongo (0.1.6) | ||
|
||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
awesome_print (0.4.0) | ||
bones (3.7.0) | ||
little-plugger (>= 1.1.2) | ||
loquacious (>= 1.7.0) | ||
rake (>= 0.8.7) | ||
diff-lcs (1.1.2) | ||
little-plugger (1.1.2) | ||
loquacious (1.8.1) | ||
rake (0.9.2) | ||
rspec (2.6.0) | ||
rspec-core (~> 2.6.0) | ||
rspec-expectations (~> 2.6.0) | ||
rspec-mocks (~> 2.6.0) | ||
rspec-core (2.6.4) | ||
rspec-expectations (2.6.0) | ||
diff-lcs (~> 1.1.2) | ||
rspec-mocks (2.6.0) | ||
|
||
PLATFORMS | ||
java | ||
|
||
DEPENDENCIES | ||
awesome_print | ||
bones (>= 3.4.1) | ||
jmongo! | ||
rspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,35 @@ | ||
|
||
require File.join(File.dirname(__FILE__), %w[spec_helper]) | ||
|
||
describe Mongo do | ||
end | ||
let(:doc) { { :parent => { :child_1 => '1', :child_2 => 2 } } } | ||
|
||
before do | ||
connection = Mongo::Connection.new('localhost', 27017, :safe => { :fsync => true }) | ||
@db = connection.db('jmongo_specs') | ||
@db.collections.select { |c| c.name !~ /system/ }.each { |c| @db.drop_collection c.name } | ||
@db.create_collection 'docs' | ||
@collection = @db.collection 'docs' | ||
@collection.insert doc | ||
end | ||
|
||
context "find all" do | ||
subject { @collection.find.to_a } | ||
it { should have(1).item } | ||
end | ||
|
||
context "complex query" do | ||
let(:doc2) { { :_id => { :id_1 => 'x', :id_2 => 5 }, :foo => 'bar' } } | ||
let(:query) { { '_id.id_2' => 5, '_id.id_1' => 'x' } } | ||
before { @collection.insert doc2 } | ||
|
||
describe "failing find_one" do | ||
subject { @collection.find_one(query) } | ||
it { should_not be_nil } | ||
end | ||
|
||
describe "passing find" do | ||
subject { @collection.find(query).to_a.first } | ||
it { should_not be_nil } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters