browse-everything 0.11.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +15 -3
- data/.rubocop_todo.yml +28 -17
- data/CONTRIBUTING.md +66 -20
- data/app/assets/javascripts/browse_everything/behavior.js.coffee +23 -13
- data/app/assets/stylesheets/browse_everything/_browse_everything.scss +8 -9
- data/app/controllers/browse_everything_controller.rb +2 -0
- data/app/views/browse_everything/_file.html.erb +25 -8
- data/browse-everything.gemspec +2 -1
- data/lib/browse_everything/driver/s3.rb +19 -20
- data/lib/browse_everything/version.rb +1 -1
- data/spec/features/select_files_spec.rb +3 -2
- data/spec/features/test_compiling_stylesheets_spec.rb +1 -1
- data/spec/helper/browse_everything_controller_helper_spec.rb +5 -11
- data/spec/unit/base_spec.rb +20 -14
- data/spec/unit/browse_everything_helper_spec.rb +6 -6
- data/spec/unit/browser_spec.rb +24 -22
- data/spec/unit/dropbox_spec.rb +52 -48
- data/spec/unit/file_entry_spec.rb +19 -58
- data/spec/unit/file_system_spec.rb +33 -33
- data/spec/unit/retriever_spec.rb +10 -12
- data/spec/unit/s3_spec.rb +25 -25
- data/spec/unit/sky_drive_spec.rb +54 -40
- data/spec/views/browse_everything/_file.html.erb_spec.rb +5 -5
- data/tasks/ci.rake +8 -1
- metadata +21 -7
@@ -1,34 +1,51 @@
|
|
1
|
-
|
1
|
+
<%# Never disable folders. Files are only disabled if their size exceeds the maximum %>
|
2
|
+
<% if file.container? || provider.config[:max_upload_file_size].blank?
|
2
3
|
disabled = false
|
3
4
|
else
|
4
5
|
max_size = provider.config[:max_upload_file_size].to_i
|
5
6
|
disabled = file.size > max_size
|
6
7
|
end
|
7
8
|
%>
|
8
|
-
<tr role="row" tabindex="-1"
|
9
|
+
<tr role="row" tabindex="-1"
|
10
|
+
data-ev-location="<%= file.location %>"
|
11
|
+
data-tt-id="<%=path%>"
|
12
|
+
data-tt-parent-id="<%=parent%>"
|
13
|
+
data-tt-branch="<%=file.container? ? 'true' : 'false'%>">
|
14
|
+
|
9
15
|
<td role="gridcell" class="<%=file.container? ? 'ev-container' : 'ev-file'%> ev-file-name">
|
10
16
|
<% if disabled %>
|
11
|
-
<span title="<%= t('browse_everything.size_disabled', max_size: number_to_human_size(max_size)) %>"
|
12
|
-
|
17
|
+
<span title="<%= t('browse_everything.size_disabled', max_size: number_to_human_size(max_size)) %>"
|
18
|
+
class="<%=file.container? ? 'folder' : 'file'%>" aria-hidden="true">
|
19
|
+
<%= file.name %>
|
13
20
|
</span>
|
14
21
|
<span class="sr-only"><%= file.container? ? ', folder' : ', file' %> </span>
|
15
22
|
<% else %>
|
16
|
-
<%= link_to browse_everything_engine.contents_path(provider_name,file.id), :
|
23
|
+
<%= link_to browse_everything_engine.contents_path(provider_name, file.id), class: 'ev-link' do %>
|
17
24
|
<span class="<%=file.container? ? 'folder' : 'file'%>" aria-hidden="true"/>
|
18
25
|
<%= file.name %>
|
19
26
|
<span class="sr-only"><%= file.container? ? ', folder' : ', file' %> </span>
|
20
27
|
<% end %>
|
21
28
|
<% end %>
|
22
29
|
</td>
|
23
|
-
|
24
|
-
|
25
|
-
|
30
|
+
|
31
|
+
<% if file.container? %>
|
32
|
+
<td role="gridcell" class="ev-directory-select">
|
33
|
+
<%= check_box_tag(:select_all, "0", false, class: "ev-select-all") %>
|
34
|
+
</td>
|
35
|
+
<% else %>
|
36
|
+
<td role="gridcell" class="ev-file-select">
|
37
|
+
<%= check_box_tag(file.id.to_s.parameterize, "0", false, class: "ev-select-file") %>
|
38
|
+
</td>
|
39
|
+
<% end %>
|
40
|
+
|
26
41
|
<td role="gridcell" class="ev-file-size">
|
27
42
|
<%= number_to_human_size(file.size).sub(/Bytes/,'bytes') %>
|
28
43
|
</td>
|
44
|
+
|
29
45
|
<td role="gridcell" class="ev-file-kind">
|
30
46
|
<%= file.type %>
|
31
47
|
</td>
|
48
|
+
|
32
49
|
<td role="gridcell" class="ev-file-date">
|
33
50
|
<%= file.mtime.strftime('%F %R') %>
|
34
51
|
</td>
|
data/browse-everything.gemspec
CHANGED
@@ -34,7 +34,8 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
35
35
|
spec.add_development_dependency 'rspec-rails'
|
36
36
|
spec.add_development_dependency 'rspec-its'
|
37
|
-
spec.add_development_dependency 'rubocop'
|
37
|
+
spec.add_development_dependency 'rubocop', '~> 0.42.0'
|
38
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.8.0'
|
38
39
|
spec.add_development_dependency 'simplecov'
|
39
40
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
40
41
|
spec.add_development_dependency 'pry'
|
@@ -3,35 +3,35 @@ require 'aws-sdk'
|
|
3
3
|
module BrowseEverything
|
4
4
|
module Driver
|
5
5
|
class S3 < Base
|
6
|
-
DEFAULTS = { signed_url: true, region: 'us-east-1' }
|
7
|
-
|
8
|
-
|
6
|
+
DEFAULTS = { signed_url: true, region: 'us-east-1' }.freeze
|
7
|
+
CONFIG_KEYS = [:app_key, :app_secret, :bucket].freeze
|
8
|
+
|
9
|
+
def initialize(config, *args)
|
9
10
|
config = DEFAULTS.merge(config)
|
10
11
|
super
|
11
12
|
end
|
12
|
-
|
13
|
+
|
13
14
|
def icon
|
14
15
|
'amazon'
|
15
16
|
end
|
16
|
-
|
17
|
+
|
17
18
|
def validate_config
|
18
|
-
|
19
|
-
|
20
|
-
end
|
19
|
+
return if CONFIG_KEYS.all? { |key| config[key].present? }
|
20
|
+
raise BrowseEverything::InitializationError, "Amazon S3 driver requires #{CONFIG_KEYS.join(',')}"
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def contents(path = '')
|
24
|
-
path = File.join(path,'') unless path.empty?
|
24
|
+
path = File.join(path, '') unless path.empty?
|
25
25
|
result = []
|
26
26
|
listing = client.list_objects(bucket: config[:bucket], delimiter: '/', prefix: path)
|
27
27
|
unless path.empty?
|
28
28
|
result << BrowseEverything::FileEntry.new(
|
29
29
|
Pathname(path).join('..'),
|
30
|
-
'', '..', 0, Time.
|
30
|
+
'', '..', 0, Time.current, true
|
31
31
|
)
|
32
32
|
end
|
33
33
|
listing.common_prefixes.each do |prefix|
|
34
|
-
result << entry_for(prefix.prefix, 0, Time.
|
34
|
+
result << entry_for(prefix.prefix, 0, Time.current, true)
|
35
35
|
end
|
36
36
|
listing.contents.reject { |entry| entry.key == path }.each do |entry|
|
37
37
|
result << entry_for(entry.key, entry.size, entry.last_modified, false)
|
@@ -46,21 +46,21 @@ module BrowseEverything
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def entry_for(name, size, date, dir)
|
49
|
-
BrowseEverything::FileEntry.new(name, [key,name].join(':'), File.basename(name), size, date, dir)
|
49
|
+
BrowseEverything::FileEntry.new(name, [key, name].join(':'), File.basename(name), size, date, dir)
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
def details(path)
|
53
53
|
entry = client.head_object(path)
|
54
54
|
BrowseEverything::FileEntry.new(
|
55
55
|
entry.key,
|
56
|
-
[key,entry.key].join(':'),
|
56
|
+
[key, entry.key].join(':'),
|
57
57
|
File.basename(entry.key),
|
58
58
|
entry.size,
|
59
59
|
entry.last_modified,
|
60
60
|
false
|
61
61
|
)
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
def link_for(path)
|
65
65
|
obj = bucket.object(path)
|
66
66
|
if config[:signed_url]
|
@@ -69,19 +69,18 @@ module BrowseEverything
|
|
69
69
|
obj.public_url
|
70
70
|
end
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
def authorized?
|
74
74
|
true
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
def bucket
|
78
78
|
@bucket ||= Aws::S3::Bucket.new(config[:bucket], client: client)
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
def client
|
82
82
|
@client ||= Aws::S3::Client.new(credentials: Aws::Credentials.new(config[:app_key], config[:app_secret]), region: config[:region])
|
83
83
|
end
|
84
|
-
|
85
84
|
end
|
86
85
|
end
|
87
86
|
end
|
@@ -14,12 +14,13 @@ describe 'Choosing files', type: :feature do
|
|
14
14
|
click_button('Browse')
|
15
15
|
sleep(5)
|
16
16
|
click_link('Gemfile.lock')
|
17
|
+
check('config-ru')
|
17
18
|
within('.modal-footer') do
|
18
|
-
expect(page).to have_selector('span', text: '
|
19
|
+
expect(page).to have_selector('span', text: '2 files selected')
|
19
20
|
click_button('Submit')
|
20
21
|
end
|
21
22
|
sleep(5)
|
22
|
-
expect(page).to have_selector('#status', text: '
|
23
|
+
expect(page).to have_selector('#status', text: '2 items selected')
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
@@ -6,21 +6,18 @@ describe BrowseEverythingController, type: :controller do
|
|
6
6
|
before(:all) { stub_configuration }
|
7
7
|
after(:all) { unstub_configuration }
|
8
8
|
|
9
|
+
subject { helper_context.auth_link.scan(/state/) }
|
10
|
+
|
9
11
|
let(:helper_context) { controller.view_context }
|
10
12
|
let(:browser) { BrowseEverything::Browser.new(url_options) }
|
11
13
|
|
12
|
-
before
|
13
|
-
allow(controller).to receive(:provider).and_return(provider)
|
14
|
-
end
|
14
|
+
before { allow(controller).to receive(:provider).and_return(provider) }
|
15
15
|
|
16
16
|
context 'dropbox' do
|
17
17
|
let(:provider) { browser.providers['dropbox'] }
|
18
18
|
|
19
19
|
describe 'auth_link' do
|
20
|
-
|
21
|
-
it 'has a single state' do
|
22
|
-
expect(subject.scan(/state/).length).to eq 1
|
23
|
-
end
|
20
|
+
its(:length) { is_expected.to eq(1) }
|
24
21
|
end
|
25
22
|
end
|
26
23
|
|
@@ -28,10 +25,7 @@ describe BrowseEverythingController, type: :controller do
|
|
28
25
|
let(:provider) { browser.providers['box'] }
|
29
26
|
|
30
27
|
describe 'auth_link' do
|
31
|
-
|
32
|
-
it 'has a single state' do
|
33
|
-
expect(subject.scan(/state/).length).to eq 1
|
34
|
-
end
|
28
|
+
its(:length) { is_expected.to eq(1) }
|
35
29
|
end
|
36
30
|
end
|
37
31
|
end
|
data/spec/unit/base_spec.rb
CHANGED
@@ -1,25 +1,31 @@
|
|
1
1
|
include BrowserConfigHelper
|
2
2
|
|
3
3
|
describe BrowseEverything::Driver::Base do
|
4
|
-
|
4
|
+
let(:driver) { described_class.new({}) }
|
5
5
|
|
6
6
|
describe 'simple properties' do
|
7
|
-
|
8
|
-
|
9
|
-
its(:
|
10
|
-
its(:
|
11
|
-
|
7
|
+
subject { driver }
|
8
|
+
|
9
|
+
its(:name) { is_expected.to eq('Base') }
|
10
|
+
its(:key) { is_expected.to eq('base') }
|
11
|
+
its(:icon) { is_expected.to be_a(String) }
|
12
|
+
its(:auth_link) { is_expected.to be_empty }
|
13
|
+
specify { is_expected.not_to be_authorized }
|
12
14
|
end
|
13
|
-
|
14
|
-
|
15
|
+
describe '#connect' do
|
16
|
+
subject { driver.connect({}, {}) }
|
17
|
+
it { is_expected.to be_blank }
|
15
18
|
end
|
16
|
-
|
17
|
-
|
19
|
+
describe '#contents' do
|
20
|
+
subject { driver.contents('') }
|
21
|
+
it { is_expected.to be_empty }
|
18
22
|
end
|
19
|
-
|
20
|
-
|
23
|
+
describe '#details' do
|
24
|
+
subject { driver.details('/path/to/foo.txt') }
|
25
|
+
it { is_expected.to be_nil }
|
21
26
|
end
|
22
|
-
|
23
|
-
|
27
|
+
describe '#link_for' do
|
28
|
+
subject { driver.link_for('/path/to/foo.txt') }
|
29
|
+
it { is_expected.to contain_exactly('/path/to/foo.txt', file_name: 'foo.txt') }
|
24
30
|
end
|
25
31
|
end
|
@@ -11,27 +11,27 @@ describe BrowseEverythingHelper do
|
|
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 'matches 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 'matches 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 'does 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 'does 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 'matches 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 'does 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
@@ -24,51 +24,53 @@ describe BrowseEverything::Browser do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
describe 'file config' do
|
27
|
-
|
28
|
-
subject { BrowseEverything::Browser.new(url_options) }
|
27
|
+
let(:browser) { described_class.new(url_options) }
|
29
28
|
|
30
|
-
|
31
|
-
|
29
|
+
before { allow(File).to receive(:read).and_return(file_config) }
|
30
|
+
|
31
|
+
it 'has 2 providers' do
|
32
|
+
expect(browser.providers.keys).to eq([:file_system, :dropbox])
|
32
33
|
end
|
33
34
|
|
34
|
-
it '
|
35
|
-
expect(
|
35
|
+
it 'uses the file configuration' do
|
36
|
+
expect(browser.providers[:dropbox].config[:app_key]).to eq('FileConfigKey')
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|
39
40
|
describe 'global config' do
|
40
|
-
|
41
|
-
|
41
|
+
let(:browser) { described_class.new(url_options) }
|
42
|
+
|
43
|
+
before { BrowseEverything.configure(global_config) }
|
42
44
|
|
43
|
-
it '
|
44
|
-
expect(
|
45
|
+
it 'has 2 providers' do
|
46
|
+
expect(browser.providers.keys).to eq([:file_system, :dropbox])
|
45
47
|
end
|
46
48
|
|
47
|
-
it '
|
48
|
-
expect(
|
49
|
+
it 'uses the global configuration' do
|
50
|
+
expect(browser.providers[:dropbox].config[:app_key]).to eq('GlobalConfigKey')
|
49
51
|
end
|
50
52
|
end
|
51
53
|
|
52
54
|
describe 'local config' do
|
53
|
-
|
55
|
+
let(:browser) { described_class.new(local_config) }
|
54
56
|
|
55
|
-
it '
|
56
|
-
expect(
|
57
|
+
it 'has 2 providers' do
|
58
|
+
expect(browser.providers.keys).to eq([:file_system, :dropbox])
|
57
59
|
end
|
58
60
|
|
59
|
-
it '
|
60
|
-
expect(
|
61
|
+
it 'uses the local configuration' do
|
62
|
+
expect(browser.providers[:dropbox].config[:app_key]).to eq('LocalConfigKey')
|
61
63
|
end
|
62
64
|
end
|
63
65
|
|
64
66
|
describe 'unknown provider' do
|
65
|
-
|
66
|
-
|
67
|
+
let(:browser) do
|
68
|
+
described_class.new(local_config.merge(foo: { key: 'bar', secret: 'baz' }))
|
67
69
|
end
|
68
70
|
|
69
|
-
it '
|
70
|
-
|
71
|
-
expect(
|
71
|
+
it 'complains but continue' do
|
72
|
+
expect(Rails.logger).to receive(:warn).with('Unknown provider: foo')
|
73
|
+
expect(browser.providers.keys).to eq([:file_system, :dropbox])
|
72
74
|
end
|
73
75
|
end
|
74
76
|
end
|
data/spec/unit/dropbox_spec.rb
CHANGED
@@ -19,50 +19,48 @@ describe BrowseEverything::Driver::Dropbox, vcr: { cassette_name: 'dropbox', rec
|
|
19
19
|
|
20
20
|
describe 'simple properties' do
|
21
21
|
subject { provider }
|
22
|
-
its(:name) {
|
23
|
-
its(:key) {
|
24
|
-
its(:icon) {
|
22
|
+
its(:name) { is_expected.to eq('Dropbox') }
|
23
|
+
its(:key) { is_expected.to eq('dropbox') }
|
24
|
+
its(:icon) { is_expected.to be_a(String) }
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
subject { provider }
|
29
|
-
|
30
|
-
specify { should_not be_authorized }
|
27
|
+
describe '#auth_link' do
|
28
|
+
subject { provider.auth_link[0] }
|
31
29
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
30
|
+
it { is_expected.to start_with('https://www.dropbox.com/1/oauth2/authorize') }
|
31
|
+
it { is_expected.to include('browse%2Fconnect') }
|
32
|
+
it { is_expected.to include('state') }
|
33
|
+
end
|
37
34
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
describe 'authorization' do
|
36
|
+
subject { provider }
|
37
|
+
before { provider.connect(auth_params, csrf_data) }
|
38
|
+
it { is_expected.to be_authorized }
|
42
39
|
end
|
43
40
|
|
44
41
|
describe '#contents' do
|
45
|
-
before
|
42
|
+
before { provider.connect(auth_params, csrf_data) }
|
46
43
|
|
47
44
|
context 'root directory' do
|
48
45
|
let(:contents) { provider.contents('') }
|
46
|
+
|
49
47
|
context '[0]' do
|
50
48
|
subject { contents[0] }
|
51
|
-
its(:name) {
|
52
|
-
specify {
|
49
|
+
its(:name) { is_expected.to eq('Apps') }
|
50
|
+
specify { is_expected.to be_container }
|
53
51
|
end
|
54
52
|
context '[1]' do
|
55
53
|
subject { contents[1] }
|
56
|
-
its(:name) {
|
57
|
-
specify {
|
54
|
+
its(:name) { is_expected.to eq('Books') }
|
55
|
+
specify { is_expected.to be_container }
|
58
56
|
end
|
59
57
|
context '[4]' do
|
60
58
|
subject { contents[4] }
|
61
|
-
its(:name) {
|
62
|
-
its(:size) {
|
63
|
-
its(:location) {
|
64
|
-
its(:type) {
|
65
|
-
specify {
|
59
|
+
its(:name) { is_expected.to eq('iPad intro.pdf') }
|
60
|
+
its(:size) { is_expected.to eq(208218) }
|
61
|
+
its(:location) { is_expected.to eq('dropbox:/iPad intro.pdf') }
|
62
|
+
its(:type) { is_expected.to eq('application/pdf') }
|
63
|
+
specify { is_expected.not_to be_container }
|
66
64
|
end
|
67
65
|
end
|
68
66
|
|
@@ -70,51 +68,57 @@ describe BrowseEverything::Driver::Dropbox, vcr: { cassette_name: 'dropbox', rec
|
|
70
68
|
let(:contents) { provider.contents('/Writer') }
|
71
69
|
context '[0]' do
|
72
70
|
subject { contents[0] }
|
73
|
-
|
74
|
-
|
71
|
+
|
72
|
+
its(:name) { is_expected.to eq('..') }
|
73
|
+
specify { is_expected.to be_container }
|
75
74
|
end
|
76
75
|
context '[1]' do
|
77
76
|
subject { contents[1] }
|
78
|
-
|
79
|
-
its(:
|
80
|
-
its(:
|
81
|
-
|
77
|
+
|
78
|
+
its(:name) { is_expected.to eq('About Writer.txt') }
|
79
|
+
its(:location) { is_expected.to eq('dropbox:/Writer/About Writer.txt') }
|
80
|
+
its(:type) { is_expected.to eq('text/plain') }
|
81
|
+
specify { is_expected.not_to be_container }
|
82
82
|
end
|
83
83
|
context '[2]' do
|
84
84
|
subject { contents[2] }
|
85
|
-
|
86
|
-
its(:
|
87
|
-
its(:
|
88
|
-
|
85
|
+
|
86
|
+
its(:name) { is_expected.to eq('Markdown Test.txt') }
|
87
|
+
its(:location) { is_expected.to eq('dropbox:/Writer/Markdown Test.txt') }
|
88
|
+
its(:type) { is_expected.to eq('text/plain') }
|
89
|
+
specify { is_expected.not_to be_container }
|
89
90
|
end
|
90
91
|
context '[3]' do
|
91
92
|
subject { contents[3] }
|
92
|
-
|
93
|
-
its(:
|
94
|
-
its(:
|
95
|
-
|
93
|
+
|
94
|
+
its(:name) { is_expected.to eq('Writer FAQ.txt') }
|
95
|
+
its(:location) { is_expected.to eq('dropbox:/Writer/Writer FAQ.txt') }
|
96
|
+
its(:type) { is_expected.to eq('text/plain') }
|
97
|
+
specify { is_expected.not_to be_container }
|
96
98
|
end
|
97
99
|
end
|
98
100
|
|
99
101
|
context '#details' do
|
100
102
|
subject { provider.details('') }
|
101
|
-
its(:name) {
|
103
|
+
its(:name) { is_expected.to eq('Apps') }
|
102
104
|
end
|
103
105
|
end
|
104
106
|
|
105
107
|
describe '#link_for' do
|
106
|
-
before
|
108
|
+
before { provider.connect(auth_params, csrf_data) }
|
107
109
|
|
108
110
|
context '[0]' do
|
109
|
-
|
110
|
-
|
111
|
-
specify {
|
111
|
+
let(:link) { provider.link_for('/Writer/Writer FAQ.txt') }
|
112
|
+
|
113
|
+
specify { expect(link[0]).to eq('https://dl.dropboxusercontent.com/1/view/FakeDropboxAccessPath/Writer/Writer%20FAQ.txt') }
|
114
|
+
specify { expect(link[1]).to have_key(:expires) }
|
112
115
|
end
|
113
116
|
|
114
117
|
context '[1]' do
|
115
|
-
|
116
|
-
|
117
|
-
specify {
|
118
|
+
let(:link) { provider.link_for('/Writer/Markdown Test.txt') }
|
119
|
+
|
120
|
+
specify { expect(link[0]).to eq('https://dl.dropboxusercontent.com/1/view/FakeDropboxAccessPath/Writer/Markdown%20Test.txt') }
|
121
|
+
specify { expect(link[1]).to have_key(:expires) }
|
118
122
|
end
|
119
123
|
end
|
120
124
|
end
|