spec/folder_spec.rb in box-api-0.1.6 vs spec/folder_spec.rb in box-api-0.1.7
- old
+ new
@@ -7,11 +7,11 @@
describe Box::Folder do
context "with api" do
before(:all) do
@root = get_root
- spec = @root.find(:name => 'rspec folder', :type => 'folder', :recursive => false).first
+ spec = @root.find(:name => 'rspec folder', :type => 'folder').first
spec.delete if spec
end
before(:each) do
@test_root = @root.create('rspec folder')
@@ -56,59 +56,59 @@
end
describe "#find" do
describe "single result" do
it "finds existing item" do
- file = @root.find(:name => 'expected.1.swf').first
+ file = @root.find(:name => 'expected.1.swf', :recursive => true).first
file.id.should == '61679540'
file.name.should == 'expected.1.swf'
end
it "finds non-existant file" do
- file = @root.find(:name => 'notfound.png').first
+ file = @root.find(:name => 'notfound.png', :recursive => true).first
file.should be nil
end
it "finds specified format" do
- folder = @root.find(:name => 'tests', :type => 'folder').first
+ folder = @root.find(:name => 'tests', :type => 'folder', :recursive => true).first
folder.id.should == '7065552'
folder.name.should == 'tests'
- file = @root.find(:name => 'tests', :type => 'file').first
+ file = @root.find(:name => 'tests', :type => 'file', :recursive => true).first
file.should be nil
end
it "finds specified criteria" do
- file = @root.find(:type => 'file', :sha1 => 'f7379ffe883fdc355fbe47e8a4b3073f21ac0f6d').first
+ file = @root.find(:type => 'file', :sha1 => 'f7379ffe883fdc355fbe47e8a4b3073f21ac0f6d', :recursive => true).first
file.id.should == '61669270'
file.name.should == 'file.pdf'
end
it "obeys recursive flag" do
file = @root.find(:type => 'file', :sha1 => 'f7379ffe883fdc355fbe47e8a4b3073f21ac0f6d', :recursive => false).first
file.should == nil
end
it "finds multiple criteria" do
- file = @root.find(:updated => 1304959908, :size => 20372).first
+ file = @root.find(:updated => 1304959908, :size => 20372, :recursive => true).first
file.id.should == '61679546'
file.name.should == 'expected.3.swf'
end
it "requires both criteria" do
- file = @root.find(:updated => 1304, :size => 20372).first
+ file = @root.find(:updated => 1304, :size => 20372, :recursive => true).first
file.should be nil
end
end
describe "multiple results" do
it "finds multiple files" do
- items = @root.find(:name => 'expected.1.swf')
+ items = @root.find(:name => 'expected.1.swf', :recursive => true)
items.should have(2).items
end
it "finds all files" do
- files = @root.find(:type => 'file')
+ files = @root.find(:type => 'file', :recursive => true)
files.should have(9).items
files.first.name.should == 'file.pdf'
end
end
end