browse-everything 0.10.5 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +16 -0
- data/.rubocop_todo.yml +149 -0
- data/.travis.yml +5 -6
- data/Rakefile +2 -2
- data/app/controllers/browse_everything_controller.rb +19 -22
- data/app/helpers/bootstrap_version_helper.rb +9 -11
- data/app/helpers/browse_everything_helper.rb +11 -22
- data/app/views/browse_everything/_file.html.erb +7 -11
- data/app/views/browse_everything/_files.html.erb +4 -7
- data/app/views/browse_everything/index.html.erb +1 -1
- data/browse-everything.gemspec +37 -34
- data/config/routes.rb +3 -3
- data/lib/browse-everything.rb +1 -1
- data/lib/browse_everything.rb +9 -8
- data/lib/browse_everything/browser.rb +4 -4
- data/lib/browse_everything/driver/base.rb +14 -14
- data/lib/browse_everything/driver/box.rb +48 -59
- data/lib/browse_everything/driver/dropbox.rb +10 -11
- data/lib/browse_everything/driver/file_system.rb +19 -24
- data/lib/browse_everything/driver/google_drive.rb +58 -82
- data/lib/browse_everything/driver/s3.rb +87 -0
- data/lib/browse_everything/driver/sky_drive.rb +41 -47
- data/lib/browse_everything/engine.rb +2 -2
- data/lib/browse_everything/file_entry.rb +3 -3
- data/lib/browse_everything/retriever.rb +19 -20
- data/lib/browse_everything/version.rb +1 -1
- data/lib/generators/browse_everything/assets_generator.rb +2 -4
- data/lib/generators/browse_everything/config_generator.rb +12 -12
- data/lib/generators/browse_everything/install_generator.rb +2 -4
- data/lib/generators/browse_everything/templates/browse_everything_providers.yml.example +6 -0
- data/spec/features/select_files_spec.rb +12 -12
- data/spec/features/test_compiling_stylesheets_spec.rb +2 -2
- data/spec/helper/browse_everything_controller_helper_spec.rb +8 -8
- data/spec/javascripts/jasmine_spec.rb +5 -5
- data/spec/javascripts/support/jasmine_helper.rb +9 -9
- data/spec/spec_helper.rb +26 -23
- data/spec/support/app/controllers/file_handler_controller.rb +3 -3
- data/spec/support/rake.rb +1 -1
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +21 -22
- data/spec/unit/base_spec.rb +6 -6
- data/spec/unit/browse_everything_helper_spec.rb +9 -9
- data/spec/unit/browser_spec.rb +19 -19
- data/spec/unit/dropbox_spec.rb +44 -43
- data/spec/unit/file_entry_spec.rb +31 -31
- data/spec/unit/file_system_spec.rb +26 -26
- data/spec/unit/retriever_spec.rb +42 -43
- data/spec/unit/s3_spec.rb +77 -0
- data/spec/unit/sky_drive_spec.rb +31 -31
- data/spec/views/browse_everything/_file.html.erb_spec.rb +37 -37
- data/tasks/ci.rake +3 -3
- metadata +52 -7
- data/app/.DS_Store +0 -0
- data/app/views/.DS_Store +0 -0
data/spec/unit/base_spec.rb
CHANGED
@@ -3,23 +3,23 @@ include BrowserConfigHelper
|
|
3
3
|
describe BrowseEverything::Driver::Base do
|
4
4
|
subject { BrowseEverything::Driver::Base.new({}) }
|
5
5
|
|
6
|
-
describe
|
6
|
+
describe 'simple properties' do
|
7
7
|
its(:name) { should == 'Base' }
|
8
8
|
its(:key) { should == 'base' }
|
9
9
|
its(:icon) { should be_a(String) }
|
10
10
|
its(:auth_link) { should be_empty }
|
11
11
|
specify { should_not be_authorized }
|
12
12
|
end
|
13
|
-
context
|
14
|
-
specify { subject.connect({},{}).should be_blank }
|
13
|
+
context '#connect' do
|
14
|
+
specify { subject.connect({}, {}).should be_blank }
|
15
15
|
end
|
16
|
-
context
|
16
|
+
context '#contents' do
|
17
17
|
specify { subject.contents('').should be_empty }
|
18
18
|
end
|
19
|
-
context
|
19
|
+
context '#details' do
|
20
20
|
specify { subject.details('/path/to/foo.txt').should be_nil }
|
21
21
|
end
|
22
|
-
context
|
22
|
+
context '#link_for' do
|
23
23
|
specify { subject.link_for('/path/to/foo.txt').should == ['/path/to/foo.txt', { file_name: 'foo.txt' }] }
|
24
24
|
end
|
25
25
|
end
|
@@ -1,37 +1,37 @@
|
|
1
1
|
describe BrowseEverythingHelper do
|
2
|
-
let(:test_class)
|
2
|
+
let(:test_class) do
|
3
3
|
Class.new do
|
4
4
|
include BrowseEverythingHelper
|
5
5
|
attr_reader :params
|
6
|
-
def initialize
|
6
|
+
def initialize(params)
|
7
7
|
@params = params
|
8
8
|
end
|
9
9
|
end
|
10
|
-
|
10
|
+
end
|
11
11
|
|
12
12
|
let(:test_file) { BrowseEverything::FileEntry.new 0, '/path/to/file.mp4', 'file.mp4', 12345, Time.now, false }
|
13
13
|
|
14
|
-
it
|
14
|
+
it 'should match a full type' do
|
15
15
|
expect(test_class.new(accept: 'video/mp4').is_acceptable?(test_file)).to eq(true)
|
16
16
|
end
|
17
17
|
|
18
|
-
it
|
18
|
+
it 'should match a wildcard type' do
|
19
19
|
expect(test_class.new(accept: 'video/*').is_acceptable?(test_file)).to eq(true)
|
20
20
|
end
|
21
21
|
|
22
|
-
it
|
22
|
+
it 'should not match the wrong full type' do
|
23
23
|
expect(test_class.new(accept: 'video/mpeg').is_acceptable?(test_file)).to eq(false)
|
24
24
|
end
|
25
25
|
|
26
|
-
it
|
26
|
+
it 'should not match the wrong wildcard type' do
|
27
27
|
expect(test_class.new(accept: 'audio/*').is_acceptable?(test_file)).to eq(false)
|
28
28
|
end
|
29
29
|
|
30
|
-
it
|
30
|
+
it 'should match a type list' do
|
31
31
|
expect(test_class.new(accept: 'audio/*, video/mp4').is_acceptable?(test_file)).to eq(true)
|
32
32
|
end
|
33
33
|
|
34
|
-
it
|
34
|
+
it 'should not match the wrong type list' do
|
35
35
|
expect(test_class.new(accept: 'audio/*, application/json').is_acceptable?(test_file)).to eq(false)
|
36
36
|
end
|
37
37
|
end
|
data/spec/unit/browser_spec.rb
CHANGED
@@ -1,72 +1,72 @@
|
|
1
1
|
include BrowserConfigHelper
|
2
2
|
|
3
3
|
describe BrowseEverything::Browser do
|
4
|
-
let(:file_config)
|
4
|
+
let(:file_config) do
|
5
5
|
{
|
6
6
|
file_system: { home: '/file/config/home' },
|
7
7
|
dropbox: { app_key: 'FileConfigKey', app_secret: 'FileConfigSecret' }
|
8
8
|
}.to_yaml
|
9
|
-
|
9
|
+
end
|
10
10
|
|
11
|
-
let(:global_config)
|
11
|
+
let(:global_config) do
|
12
12
|
{
|
13
13
|
file_system: { home: '/global/config/home' },
|
14
14
|
dropbox: { app_key: 'GlobalConfigKey', app_secret: 'GlobalConfigSecret' }
|
15
15
|
}
|
16
|
-
|
16
|
+
end
|
17
17
|
|
18
|
-
let(:local_config)
|
18
|
+
let(:local_config) do
|
19
19
|
{
|
20
20
|
file_system: { home: '/local/config/home' },
|
21
21
|
dropbox: { app_key: 'LocalConfigKey', app_secret: 'LocalConfigSecret' },
|
22
22
|
url_options: url_options
|
23
23
|
}
|
24
|
-
|
24
|
+
end
|
25
25
|
|
26
|
-
describe
|
26
|
+
describe 'file config' do
|
27
27
|
before(:each) { allow(File).to receive(:read).and_return(file_config) }
|
28
28
|
subject { BrowseEverything::Browser.new(url_options) }
|
29
29
|
|
30
|
-
it
|
30
|
+
it 'should have 2 providers' do
|
31
31
|
expect(subject.providers.keys).to eq([:file_system, :dropbox])
|
32
32
|
end
|
33
33
|
|
34
|
-
it
|
34
|
+
it 'should use the file configuration' do
|
35
35
|
expect(subject.providers[:dropbox].config[:app_key]).to eq('FileConfigKey')
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
describe
|
39
|
+
describe 'global config' do
|
40
40
|
before(:each) { BrowseEverything.configure(global_config) }
|
41
41
|
subject { BrowseEverything::Browser.new(url_options) }
|
42
42
|
|
43
|
-
it
|
43
|
+
it 'should have 2 providers' do
|
44
44
|
expect(subject.providers.keys).to eq([:file_system, :dropbox])
|
45
45
|
end
|
46
46
|
|
47
|
-
it
|
47
|
+
it 'should use the global configuration' do
|
48
48
|
expect(subject.providers[:dropbox].config[:app_key]).to eq('GlobalConfigKey')
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
describe
|
52
|
+
describe 'local config' do
|
53
53
|
subject { BrowseEverything::Browser.new(local_config) }
|
54
54
|
|
55
|
-
it
|
55
|
+
it 'should have 2 providers' do
|
56
56
|
expect(subject.providers.keys).to eq([:file_system, :dropbox])
|
57
57
|
end
|
58
58
|
|
59
|
-
it
|
59
|
+
it 'should use the local configuration' do
|
60
60
|
expect(subject.providers[:dropbox].config[:app_key]).to eq('LocalConfigKey')
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
describe
|
65
|
-
subject
|
64
|
+
describe 'unknown provider' do
|
65
|
+
subject do
|
66
66
|
BrowseEverything::Browser.new(local_config.merge(foo: { key: 'bar', secret: 'baz' }))
|
67
|
-
|
67
|
+
end
|
68
68
|
|
69
|
-
it
|
69
|
+
it 'should complain but continue' do
|
70
70
|
allow(Rails.logger).to receive(:warn).with('Unknown provider: foo')
|
71
71
|
expect(subject.providers.keys).to eq([:file_system, :dropbox])
|
72
72
|
end
|
data/spec/unit/dropbox_spec.rb
CHANGED
@@ -6,113 +6,114 @@ describe BrowseEverything::Driver::Dropbox, vcr: { cassette_name: 'dropbox', rec
|
|
6
6
|
|
7
7
|
let(:browser) { BrowseEverything::Browser.new(url_options) }
|
8
8
|
let(:provider) { browser.providers['dropbox'] }
|
9
|
-
let(:auth_params)
|
9
|
+
let(:auth_params) do {
|
10
10
|
'code' => 'FakeDropboxAuthorizationCodeABCDEFG',
|
11
11
|
'state' => 'GjDcUhPNZrZzdsw%2FghBy2A%3D%3D|dropbox'
|
12
|
-
}
|
13
|
-
|
12
|
+
}
|
13
|
+
end
|
14
|
+
let(:csrf_data) { { 'token' => 'GjDcUhPNZrZzdsw%2FghBy2A%3D%3D' } }
|
14
15
|
|
15
|
-
it
|
16
|
+
it '#validate_config' do
|
16
17
|
expect { BrowseEverything::Driver::Dropbox.new({}) }.to raise_error(BrowseEverything::InitializationError)
|
17
18
|
end
|
18
19
|
|
19
|
-
describe
|
20
|
-
subject { provider
|
20
|
+
describe 'simple properties' do
|
21
|
+
subject { provider }
|
21
22
|
its(:name) { should == 'Dropbox' }
|
22
23
|
its(:key) { should == 'dropbox' }
|
23
|
-
its(:icon) { should be_a(String)
|
24
|
+
its(:icon) { should be_a(String) }
|
24
25
|
end
|
25
26
|
|
26
|
-
context
|
27
|
+
context 'authorization' do
|
27
28
|
subject { provider }
|
28
29
|
|
29
30
|
specify { should_not be_authorized }
|
30
31
|
|
31
|
-
context
|
32
|
+
context '#auth_link' do
|
32
33
|
specify { subject.auth_link[0].should start_with('https://www.dropbox.com/1/oauth2/authorize') }
|
33
34
|
specify { subject.auth_link[0].should include('browse%2Fconnect') }
|
34
35
|
specify { subject.auth_link[0].should include('state') }
|
35
36
|
end
|
36
37
|
|
37
|
-
it
|
38
|
-
subject.connect(auth_params,csrf_data)
|
38
|
+
it 'should authorize' do
|
39
|
+
subject.connect(auth_params, csrf_data)
|
39
40
|
expect(subject).to be_authorized
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
43
|
-
describe
|
44
|
-
before(:each) { provider.connect(auth_params,csrf_data) }
|
44
|
+
describe '#contents' do
|
45
|
+
before(:each) { provider.connect(auth_params, csrf_data) }
|
45
46
|
|
46
|
-
context
|
47
|
+
context 'root directory' do
|
47
48
|
let(:contents) { provider.contents('') }
|
48
|
-
context
|
49
|
+
context '[0]' do
|
49
50
|
subject { contents[0] }
|
50
51
|
its(:name) { should == 'Apps' }
|
51
52
|
specify { should be_container }
|
52
53
|
end
|
53
|
-
context
|
54
|
+
context '[1]' do
|
54
55
|
subject { contents[1] }
|
55
56
|
its(:name) { should == 'Books' }
|
56
57
|
specify { should be_container }
|
57
58
|
end
|
58
|
-
context
|
59
|
+
context '[4]' do
|
59
60
|
subject { contents[4] }
|
60
|
-
its(:name) { should == 'iPad intro.pdf'
|
61
|
-
its(:size) { should == 208218
|
62
|
-
its(:location) { should ==
|
63
|
-
its(:type) { should ==
|
61
|
+
its(:name) { should == 'iPad intro.pdf' }
|
62
|
+
its(:size) { should == 208218 }
|
63
|
+
its(:location) { should == 'dropbox:/iPad intro.pdf' }
|
64
|
+
its(:type) { should == 'application/pdf' }
|
64
65
|
specify { should_not be_container }
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
68
|
-
context
|
69
|
+
context 'subdirectory' do
|
69
70
|
let(:contents) { provider.contents('/Writer') }
|
70
|
-
context
|
71
|
+
context '[0]' do
|
71
72
|
subject { contents[0] }
|
72
73
|
its(:name) { should == '..' }
|
73
74
|
specify { should be_container }
|
74
75
|
end
|
75
|
-
context
|
76
|
+
context '[1]' do
|
76
77
|
subject { contents[1] }
|
77
|
-
its(:name) { should == 'About Writer.txt'
|
78
|
-
its(:location) { should ==
|
79
|
-
its(:type) { should ==
|
78
|
+
its(:name) { should == 'About Writer.txt' }
|
79
|
+
its(:location) { should == 'dropbox:/Writer/About Writer.txt' }
|
80
|
+
its(:type) { should == 'text/plain' }
|
80
81
|
specify { should_not be_container }
|
81
82
|
end
|
82
|
-
context
|
83
|
+
context '[2]' do
|
83
84
|
subject { contents[2] }
|
84
|
-
its(:name) { should == 'Markdown Test.txt'
|
85
|
-
its(:location) { should ==
|
86
|
-
its(:type) { should ==
|
85
|
+
its(:name) { should == 'Markdown Test.txt' }
|
86
|
+
its(:location) { should == 'dropbox:/Writer/Markdown Test.txt' }
|
87
|
+
its(:type) { should == 'text/plain' }
|
87
88
|
specify { should_not be_container }
|
88
89
|
end
|
89
|
-
context
|
90
|
+
context '[3]' do
|
90
91
|
subject { contents[3] }
|
91
|
-
its(:name) { should == 'Writer FAQ.txt'
|
92
|
-
its(:location) { should ==
|
93
|
-
its(:type) { should ==
|
92
|
+
its(:name) { should == 'Writer FAQ.txt' }
|
93
|
+
its(:location) { should == 'dropbox:/Writer/Writer FAQ.txt' }
|
94
|
+
its(:type) { should == 'text/plain' }
|
94
95
|
specify { should_not be_container }
|
95
96
|
end
|
96
97
|
end
|
97
98
|
|
98
|
-
context
|
99
|
+
context '#details' do
|
99
100
|
subject { provider.details('') }
|
100
|
-
its(:name) { should == 'Apps'
|
101
|
+
its(:name) { should == 'Apps' }
|
101
102
|
end
|
102
103
|
end
|
103
104
|
|
104
|
-
describe
|
105
|
-
before(:each) { provider.connect(auth_params,csrf_data) }
|
105
|
+
describe '#link_for' do
|
106
|
+
before(:each) { provider.connect(auth_params, csrf_data) }
|
106
107
|
|
107
|
-
context
|
108
|
+
context '[0]' do
|
108
109
|
subject { provider.link_for('/Writer/Writer FAQ.txt') }
|
109
|
-
specify { subject[0].should ==
|
110
|
+
specify { subject[0].should == 'https://dl.dropboxusercontent.com/1/view/FakeDropboxAccessPath/Writer/Writer%20FAQ.txt' }
|
110
111
|
specify { subject[1].should have_key(:expires) }
|
111
112
|
end
|
112
113
|
|
113
|
-
context
|
114
|
+
context '[1]' do
|
114
115
|
subject { provider.link_for('/Writer/Markdown Test.txt') }
|
115
|
-
specify { subject[0].should ==
|
116
|
+
specify { subject[0].should == 'https://dl.dropboxusercontent.com/1/view/FakeDropboxAccessPath/Writer/Markdown%20Test.txt' }
|
116
117
|
specify { subject[1].should have_key(:expires) }
|
117
118
|
end
|
118
119
|
end
|
@@ -1,88 +1,88 @@
|
|
1
1
|
describe BrowseEverything::FileEntry do
|
2
2
|
let(:mtime) { Time.now }
|
3
|
-
describe
|
4
|
-
subject
|
3
|
+
describe 'regular file' do
|
4
|
+
subject do
|
5
5
|
BrowseEverything::FileEntry.new(
|
6
6
|
'file_id_01234', 'my_provider:/location/pa/th/file.m4v',
|
7
7
|
'file.m4v', '1.2 GB', mtime, false
|
8
8
|
)
|
9
|
-
|
9
|
+
end
|
10
10
|
|
11
|
-
it
|
11
|
+
it 'should be a BrowseEverything::FileEntry' do
|
12
12
|
expect(subject).to be_a BrowseEverything::FileEntry
|
13
13
|
end
|
14
14
|
|
15
|
-
it
|
16
|
-
expect(subject.id).to eq(
|
15
|
+
it '#id' do
|
16
|
+
expect(subject.id).to eq('file_id_01234')
|
17
17
|
end
|
18
18
|
|
19
|
-
it
|
20
|
-
expect(subject.location).to eq(
|
19
|
+
it '#location' do
|
20
|
+
expect(subject.location).to eq('my_provider:/location/pa/th/file.m4v')
|
21
21
|
end
|
22
22
|
|
23
|
-
it
|
24
|
-
expect(subject.name).to eq(
|
23
|
+
it '#name' do
|
24
|
+
expect(subject.name).to eq('file.m4v')
|
25
25
|
end
|
26
26
|
|
27
|
-
it
|
28
|
-
expect(subject.size).to eq(
|
27
|
+
it '#size' do
|
28
|
+
expect(subject.size).to eq('1.2 GB')
|
29
29
|
end
|
30
30
|
|
31
|
-
it
|
31
|
+
it '#mtime' do
|
32
32
|
expect(subject.mtime).to eq(mtime)
|
33
33
|
end
|
34
34
|
|
35
|
-
it
|
36
|
-
expect(subject.type).to eq(
|
35
|
+
it '#type' do
|
36
|
+
expect(subject.type).to eq('video/mp4')
|
37
37
|
end
|
38
38
|
|
39
|
-
it
|
39
|
+
it '#container?' do
|
40
40
|
expect(subject.container?).to be false
|
41
41
|
end
|
42
42
|
|
43
|
-
it
|
43
|
+
it '#relative_parent_path?' do
|
44
44
|
expect(subject.relative_parent_path?).to be false
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
describe
|
49
|
-
subject
|
48
|
+
describe 'directory' do
|
49
|
+
subject do
|
50
50
|
BrowseEverything::FileEntry.new(
|
51
51
|
'directory_id_1234', 'my_provider:/location/pa/th',
|
52
52
|
'th', '', mtime, true
|
53
53
|
)
|
54
|
-
|
54
|
+
end
|
55
55
|
|
56
|
-
it
|
57
|
-
expect(subject.type).to eq(
|
56
|
+
it '#type' do
|
57
|
+
expect(subject.type).to eq('application/x-directory')
|
58
58
|
end
|
59
59
|
|
60
|
-
it
|
60
|
+
it '#container?' do
|
61
61
|
expect(subject.container?).to be true
|
62
62
|
end
|
63
63
|
|
64
|
-
it
|
64
|
+
it '#relative_parent_path?' do
|
65
65
|
expect(subject.relative_parent_path?).to be false
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
describe
|
70
|
-
subject
|
69
|
+
describe 'parent path' do
|
70
|
+
subject do
|
71
71
|
BrowseEverything::FileEntry.new(
|
72
72
|
'directory_id_1234', 'my_provider:/location/pa/th',
|
73
73
|
'..', '', mtime, true
|
74
74
|
)
|
75
|
-
|
75
|
+
end
|
76
76
|
|
77
|
-
it
|
78
|
-
expect(subject.type).to eq(
|
77
|
+
it '#type' do
|
78
|
+
expect(subject.type).to eq('application/x-directory')
|
79
79
|
end
|
80
80
|
|
81
|
-
it
|
81
|
+
it '#container?' do
|
82
82
|
expect(subject.container?).to be true
|
83
83
|
end
|
84
84
|
|
85
|
-
it
|
85
|
+
it '#relative_parent_path?' do
|
86
86
|
expect(subject.relative_parent_path?).to be true
|
87
87
|
end
|
88
88
|
end
|
@@ -7,11 +7,11 @@ describe BrowseEverything::Driver::FileSystem do
|
|
7
7
|
let(:browser) { BrowseEverything::Browser.new(url_options) }
|
8
8
|
let(:provider) { browser.providers['file_system'] }
|
9
9
|
|
10
|
-
it
|
10
|
+
it '#validate_config' do
|
11
11
|
expect { BrowseEverything::Driver::FileSystem.new({}) }.to raise_error(BrowseEverything::InitializationError)
|
12
12
|
end
|
13
13
|
|
14
|
-
describe
|
14
|
+
describe 'simple properties' do
|
15
15
|
subject { provider }
|
16
16
|
its(:name) { should == 'File System' }
|
17
17
|
its(:key) { should == 'file_system' }
|
@@ -19,66 +19,66 @@ describe BrowseEverything::Driver::FileSystem do
|
|
19
19
|
specify { should be_authorized }
|
20
20
|
end
|
21
21
|
|
22
|
-
describe
|
23
|
-
context
|
22
|
+
describe '#contents' do
|
23
|
+
context 'root directory' do
|
24
24
|
let(:contents) { provider.contents('/') }
|
25
|
-
context
|
25
|
+
context '[0]' do
|
26
26
|
subject { contents[0] }
|
27
27
|
its(:name) { should == 'dir_1' }
|
28
28
|
specify { should be_container }
|
29
29
|
end
|
30
|
-
context
|
30
|
+
context '[1]' do
|
31
31
|
subject { contents[1] }
|
32
32
|
its(:name) { should == 'dir_2' }
|
33
33
|
specify { should be_container }
|
34
34
|
end
|
35
|
-
context
|
35
|
+
context '[2]' do
|
36
36
|
subject { contents[2] }
|
37
37
|
its(:name) { should == 'file 1.pdf' }
|
38
38
|
its(:size) { should == 2256 }
|
39
|
-
its(:location) { should == "file_system:#{File.join(home,'file 1.pdf')}" }
|
40
|
-
its(:type) { should ==
|
39
|
+
its(:location) { should == "file_system:#{File.join(home, 'file 1.pdf')}" }
|
40
|
+
its(:type) { should == 'application/pdf' }
|
41
41
|
specify { should_not be_container }
|
42
42
|
end
|
43
|
-
context
|
43
|
+
context '[3]' do
|
44
44
|
subject { contents[3] }
|
45
45
|
its(:name) { should == 'file_1.pdf' }
|
46
46
|
its(:size) { should == 2256 }
|
47
|
-
its(:location) { should == "file_system:#{File.join(home,'file_1.pdf')}" }
|
48
|
-
its(:type) { should ==
|
47
|
+
its(:location) { should == "file_system:#{File.join(home, 'file_1.pdf')}" }
|
48
|
+
its(:type) { should == 'application/pdf' }
|
49
49
|
specify { should_not be_container }
|
50
50
|
end
|
51
|
-
|
51
|
+
end
|
52
52
|
|
53
|
-
context
|
53
|
+
context 'subdirectory' do
|
54
54
|
let(:contents) { provider.contents('/dir_1') }
|
55
|
-
context
|
55
|
+
context '[0]' do
|
56
56
|
subject { contents[0] }
|
57
57
|
its(:name) { should == '..' }
|
58
58
|
specify { should be_container }
|
59
59
|
end
|
60
|
-
context
|
60
|
+
context '[1]' do
|
61
61
|
subject { contents[1] }
|
62
62
|
its(:name) { should == 'dir_3' }
|
63
63
|
specify { should be_container }
|
64
64
|
end
|
65
|
-
context
|
65
|
+
context '[2]' do
|
66
66
|
subject { contents[2] }
|
67
|
-
its(:name) { should == 'file_2.txt'
|
68
|
-
its(:location) { should == "file_system:#{File.join(home,'dir_1/file_2.txt')}" }
|
69
|
-
its(:type) { should ==
|
67
|
+
its(:name) { should == 'file_2.txt' }
|
68
|
+
its(:location) { should == "file_system:#{File.join(home, 'dir_1/file_2.txt')}" }
|
69
|
+
its(:type) { should == 'text/plain' }
|
70
70
|
specify { should_not be_container }
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
context
|
74
|
+
context 'single file' do
|
75
75
|
let(:contents) { provider.contents('/dir_1/dir_3/file_3.m4v') }
|
76
|
-
context
|
76
|
+
context '[0]' do
|
77
77
|
subject { contents[0] }
|
78
|
-
its(:name) { should == 'file_3.m4v'
|
79
|
-
its(:location) { should == "file_system:#{File.join(home,'dir_1/dir_3/file_3.m4v')}" }
|
78
|
+
its(:name) { should == 'file_3.m4v' }
|
79
|
+
its(:location) { should == "file_system:#{File.join(home, 'dir_1/dir_3/file_3.m4v')}" }
|
80
80
|
its(:size) { should == 3879 }
|
81
|
-
its(:type) { should ==
|
81
|
+
its(:type) { should == 'video/mp4' }
|
82
82
|
specify { should_not be_container }
|
83
83
|
end
|
84
84
|
end
|
@@ -86,6 +86,6 @@ describe BrowseEverything::Driver::FileSystem do
|
|
86
86
|
|
87
87
|
describe "#link_for('/path/to/file')" do
|
88
88
|
subject { provider.link_for('/path/to/file') }
|
89
|
-
it { should == [
|
89
|
+
it { should == ['file:///path/to/file', { file_name: 'file', file_size: 0 }] }
|
90
90
|
end
|
91
91
|
end
|