mongo_watchable 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,7 +18,8 @@ module MongoWatchable
18
18
  end
19
19
 
20
20
  def all(opts = {})
21
- fetch_all
21
+ return fetch_all if opts.empty?
22
+ target_class.all(opts.merge(:id.in => array))
22
23
  end
23
24
 
24
25
  def each(&block)
@@ -239,6 +239,12 @@ class MongoWatchableTest < ActiveSupport::TestCase
239
239
  should "be the watcher in widget2's user_watchers array" do
240
240
  assert_equal @user, @widget2.user_watchers.first
241
241
  end
242
+
243
+ should "return correct widget with call to all with opts" do
244
+ widgets = @user.widget_watchings.all(:name => @widget.name)
245
+ assert_equal 1, widgets.size
246
+ assert_equal @widget, widgets.first
247
+ end
242
248
  end
243
249
 
244
250
  context "and then watches widget again" do
data/test/test_helper.rb CHANGED
@@ -22,7 +22,7 @@ class ActiveSupport::TestCase
22
22
  # Drop all columns after each test case.
23
23
  def teardown
24
24
  MongoMapper.database.collections.each do |coll|
25
- coll.drop
25
+ coll.remove
26
26
  end
27
27
  end
28
28
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 0
9
- version: 0.2.0
8
+ - 1
9
+ version: 0.2.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jonathan Bell
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-14 00:00:00 -05:00
17
+ date: 2010-07-01 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency