File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,8 @@ class Client
3636 # @return [ Hash ] options The configuration options.
3737 attr_reader :options
3838
39- # Delegate command execution to the current database.
40- def_delegators :@database , :command
39+ # Delegate command and collections execution to the current database.
40+ def_delegators :@database , :command , :collections
4141
4242 # Delegate subscription to monitoring.
4343 def_delegators :@monitoring , :subscribe , :unsubscribe
Original file line number Diff line number Diff line change 742742 expect ( client . dup . options ) . to be_a ( Mongo ::Options ::Redacted )
743743 end
744744 end
745+
746+ describe '#collections' do
747+
748+ before do
749+ authorized_client . database [ :users ] . create
750+ end
751+
752+ after do
753+ authorized_client . database [ :users ] . drop
754+ end
755+
756+ let ( :collection ) do
757+ Mongo ::Collection . new ( authorized_client . database , 'users' )
758+ end
759+
760+ it 'refers the current database collections' do
761+ expect ( authorized_client . collections ) . to include ( collection )
762+ expect ( authorized_client . collections ) . to all ( be_a ( Mongo ::Collection ) )
763+ end
764+ end
745765end
You can’t perform that action at this time.
0 commit comments