ruby-box 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTcwZjU5NzFkMTQ2NWIyZWNjZjE0MzI5OTU0OGQ0ODZjOTI3MmYzZA==
4
+ OTM0YjAzZDU5NjZiZDQ2NjJmZTM1ZDcxYWUwNThhNGY3MGUwMTRhNQ==
5
5
  data.tar.gz: !binary |-
6
- N2RjYjZlNzA3MTU0YWQ3NmYwYjZjNzc3NzM4M2YwMmY4YjkwZWFlOA==
6
+ MzliNmI4NTBjNjU0YzY0ZDQ4YTk0NDYzMjI3OTZkNTVlNGZlZjJmMw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NDQyZDJkNWNhOTYyYzRiMDg2Yzk2MDI5YjAxMjk1YjAwOWIzODU1MzQ0YWM0
10
- ZGY5NWFkM2U0OGI3OTYwODE4ODE2ZDBjZmVlY2ZiMjJiOTEyOGRiODkyYTRm
11
- NGY1Njk3MWQ5OTRmNzAzNzM3ZWQ1NmRiMGZmNTk5NGFjM2ExNzM=
9
+ MjBjMWY0YzE5MzE3ZGY2ZGQ0MzNmZDYxZDQ5MGM0OTk3N2M1MGEwYWY4Zjg4
10
+ Y2UzYTYxNmU0OTUwMTUwZmYwMTE4ZmNlNWZlMzJjZmIwZWFjMGJhY2E2ZTBl
11
+ ZDE1MmM0NWRhOGY3OGQ3ZmJjMzY1NWFhNjg1NzVhMzA4NTViNmI=
12
12
  data.tar.gz: !binary |-
13
- OTI2MjgzN2RmYWUwYjBlYWQ0NDVkYzY0YjYzOGYzNTNhZDNlOGY4MzU2NjY2
14
- NDU3OWRlYTdiMmZiYmNiMjQ0MTI4NWVhNjU1ODU1MWU0N2U4Y2FlMmVjNzJj
15
- NzY2YjhlZTJjMWJhMDVmMjk3MDJiMThlMTFiNWJiZDUwNWY1YmU=
13
+ NTUyYjIwM2EwZmY2NzgzZjQ0ZDk1OGRhY2JlYmNjNDIyNzQ3MDExYmJjZTNh
14
+ NWVhMmYyMzMyMTI2YzY5ODI4ZDM3NjljMzc5NGIxYzlhMzc0MTdhNDIxNjhk
15
+ OWUyNjQ0ZTgzYTM4NTBlNzY2ZDY3ZDllNTNmNjJmYmI4NDg2Yzg=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.5
1
+ 1.0.6
@@ -55,13 +55,15 @@ module RubyBox
55
55
  folder = root_folder
56
56
  folder_names = split_path(path)
57
57
  folder_names.each do |folder_name|
58
- new_folder = folder.folders(folder_name).first
59
- begin
60
- new_folder = folder.create_subfolder(folder_name)
61
- rescue RubyBox::ItemNameInUse => e
62
- new_folder = folder.folders(folder_name).first
58
+ new_folder = folder.folders(folder_name).first
59
+ if !new_folder
60
+ begin
61
+ new_folder = folder.create_subfolder(folder_name)
62
+ rescue RubyBox::ItemNameInUse => e
63
+ new_folder = folder.folders(folder_name).first
64
+ end
63
65
  end
64
- folder = new_folder ? new_folder : folder.folders(folder_name).first
66
+ folder = new_folder
65
67
  end
66
68
  folder
67
69
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ruby-box"
8
- s.version = "1.0.5"
8
+ s.version = "1.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Attachments.me"]
12
- s.date = "2013-04-01"
12
+ s.date = "2013-04-02"
13
13
  s.description = "ruby gem for box.com 2.0 api"
14
14
  s.email = "ben@attachments.me"
15
15
  s.extra_rdoc_files = [
@@ -25,4 +25,28 @@ describe RubyBox::Client do
25
25
  client.split_path('foo/bar/').should == ['foo', 'bar']
26
26
  end
27
27
  end
28
+
29
+ describe '#create_folder' do
30
+ it 'doesnt call folder.create_folder if the folder exists' do
31
+ client = RubyBox::Client.new(@session)
32
+ mock_root_folder = mock( Object )
33
+ test_folder = mock( Object )
34
+ mock_root_folder.should_receive(:folders).and_return([test_folder])
35
+ mock_root_folder.should_not_receive(:create_subfolder)
36
+ client.should_receive(:root_folder).and_return(mock_root_folder)
37
+ result = client.create_folder( '/test0')
38
+ result.should == test_folder
39
+ end
40
+
41
+ it 'calls folder.create_folder if the folder does not exist' do
42
+ client = RubyBox::Client.new(@session)
43
+ mock_root_folder = mock( Object )
44
+ test_folder = mock( Object )
45
+ mock_root_folder.should_receive(:folders).and_return([])
46
+ mock_root_folder.should_receive(:create_subfolder).and_return(test_folder)
47
+ client.should_receive(:root_folder).and_return(mock_root_folder)
48
+ result = client.create_folder( '/test0')
49
+ result.should == test_folder
50
+ end
51
+ end
28
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-box
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Attachments.me
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-01 00:00:00.000000000 Z
11
+ date: 2013-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post