Skip to content

Commit

Permalink
Missed a few bson ordered hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunemaker committed Oct 12, 2012
1 parent 9441cd2 commit d63cf95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
10 changes: 0 additions & 10 deletions spec/helper.rb
Expand Up @@ -20,22 +20,12 @@
connection = Mongo::Connection.new('127.0.0.1', 27017, :logger => Log)
DB = connection.db('test')

module OrderedHashHelpers
def oh(*args)
BSON::OrderedHash.new.tap do |hash|
args.each { |a| hash[a[0]] = a[1] }
end
end
end

RSpec.configure do |config|
config.filter_run :focused => true
config.alias_example_to :fit, :focused => true
config.alias_example_to :xit, :pending => true
config.run_all_when_everything_filtered = true

config.include OrderedHashHelpers

config.before(:suite) do
DB.collections.map do |collection|
collection.drop_indexes
Expand Down
6 changes: 3 additions & 3 deletions spec/plucky/query_spec.rb
Expand Up @@ -79,7 +79,7 @@
it "is Ruby-like and returns a reset cursor if a block is given" do
cursor = described_class.new(@collection).find_each {}
cursor.should be_instance_of(Mongo::Cursor)
cursor.next.should be_instance_of(oh.class)
cursor.next.should be_instance_of(BSON::OrderedHash)
end
end

Expand Down Expand Up @@ -281,7 +281,7 @@
context "#distinct" do
before do
# same age as John
@mark = oh(['_id', 'mark'], ['age', 28], ['name', 'Mark'])
@mark = BSON::OrderedHash['_id', 'mark', 'age', 28, 'name', 'Mark']
@collection.insert(@mark)
end

Expand Down Expand Up @@ -663,7 +663,7 @@
it "returns a working enumerator" do
query = described_class.new(@collection)
query.each.methods.map(&:to_sym).include?(:group_by).should be(true)
query.each.next.class.should == oh.class
query.each.next.should be_instance_of(BSON::OrderedHash)
end

it "uses #find_each" do
Expand Down

0 comments on commit d63cf95

Please sign in to comment.