browse-everything 0.8.4 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +5 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/browse_everything/behavior.js.coffee +91 -15
- data/app/views/browse_everything/_file.html.erb +3 -0
- data/app/views/browse_everything/_files.html.erb +1 -0
- data/browse-everything.gemspec +1 -0
- data/lib/browse_everything/driver/box.rb +11 -9
- data/lib/browse_everything/version.rb +1 -1
- data/spec/javascripts/behavior_spec.js +9 -0
- data/spec/javascripts/helpers/jasmine-jquery.js +838 -0
- data/spec/javascripts/jasmine_spec.rb +20 -0
- data/spec/javascripts/support/jasmine.yml +124 -0
- data/spec/javascripts/support/jasmine_helper.rb +15 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/rake.rb +41 -0
- data/spec/views/browse_everything/_file.html.erb_spec.rb +45 -15
- metadata +28 -2
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
# Run the jasmine tests by running the jasmine:ci rake command and parses the output for failures.
|
5
|
+
# The spec will fail if any jasmine tests fails.
|
6
|
+
describe "Jasmine" do
|
7
|
+
it "expects all jasmine tests to pass" do
|
8
|
+
load_rake_environment ["#{jasmine_path}/lib/jasmine/tasks/jasmine.rake"]
|
9
|
+
jasmine_out = run_task 'jasmine:ci'
|
10
|
+
unless jasmine_out.include? "0 failures"
|
11
|
+
puts "Some of the Jasmine tests failed"
|
12
|
+
puts jasmine_out
|
13
|
+
end
|
14
|
+
expect(jasmine_out).to include "0 failures"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def jasmine_path
|
19
|
+
Gem.loaded_specs['jasmine'].full_gem_path
|
20
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
# src_files
|
2
|
+
#
|
3
|
+
# Return an array of filepaths relative to src_dir to include before jasmine specs.
|
4
|
+
# Default: []
|
5
|
+
#
|
6
|
+
# EXAMPLE:
|
7
|
+
#
|
8
|
+
# src_files:
|
9
|
+
# - lib/source1.js
|
10
|
+
# - lib/source2.js
|
11
|
+
# - dist/**/*.js
|
12
|
+
#
|
13
|
+
src_files:
|
14
|
+
- assets/application.js
|
15
|
+
|
16
|
+
# stylesheets
|
17
|
+
#
|
18
|
+
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
|
19
|
+
# Default: []
|
20
|
+
#
|
21
|
+
# EXAMPLE:
|
22
|
+
#
|
23
|
+
# stylesheets:
|
24
|
+
# - css/style.css
|
25
|
+
# - stylesheets/*.css
|
26
|
+
#
|
27
|
+
stylesheets:
|
28
|
+
- stylesheets/**/*.css
|
29
|
+
|
30
|
+
# helpers
|
31
|
+
#
|
32
|
+
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
|
33
|
+
# Default: ["helpers/**/*.js"]
|
34
|
+
#
|
35
|
+
# EXAMPLE:
|
36
|
+
#
|
37
|
+
# helpers:
|
38
|
+
# - helpers/**/*.js
|
39
|
+
#
|
40
|
+
helpers:
|
41
|
+
- 'helpers/**/*.js'
|
42
|
+
|
43
|
+
# spec_files
|
44
|
+
#
|
45
|
+
# Return an array of filepaths relative to spec_dir to include.
|
46
|
+
# Default: ["**/*[sS]pec.js"]
|
47
|
+
#
|
48
|
+
# EXAMPLE:
|
49
|
+
#
|
50
|
+
# spec_files:
|
51
|
+
# - **/*[sS]pec.js
|
52
|
+
#
|
53
|
+
spec_files:
|
54
|
+
- '**/*[sS]pec.js*'
|
55
|
+
|
56
|
+
# src_dir
|
57
|
+
#
|
58
|
+
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
|
59
|
+
# Default: project root
|
60
|
+
#
|
61
|
+
# EXAMPLE:
|
62
|
+
#
|
63
|
+
# src_dir: public
|
64
|
+
#
|
65
|
+
src_dir:
|
66
|
+
|
67
|
+
# spec_dir
|
68
|
+
#
|
69
|
+
# Spec directory path. Your spec_files must be returned relative to this path.
|
70
|
+
# Default: spec/javascripts
|
71
|
+
#
|
72
|
+
# EXAMPLE:
|
73
|
+
#
|
74
|
+
# spec_dir: spec/javascripts
|
75
|
+
#
|
76
|
+
spec_dir:
|
77
|
+
|
78
|
+
# spec_helper
|
79
|
+
#
|
80
|
+
# Ruby file that Jasmine server will require before starting.
|
81
|
+
# Returned relative to your root path
|
82
|
+
# Default spec/javascripts/support/jasmine_helper.rb
|
83
|
+
#
|
84
|
+
# EXAMPLE:
|
85
|
+
#
|
86
|
+
# spec_helper: spec/javascripts/support/jasmine_helper.rb
|
87
|
+
#
|
88
|
+
spec_helper: spec/javascripts/support/jasmine_helper.rb
|
89
|
+
|
90
|
+
# boot_dir
|
91
|
+
#
|
92
|
+
# Boot directory path. Your boot_files must be returned relative to this path.
|
93
|
+
# Default: Built in boot file
|
94
|
+
#
|
95
|
+
# EXAMPLE:
|
96
|
+
#
|
97
|
+
# boot_dir: spec/javascripts/support/boot
|
98
|
+
#
|
99
|
+
boot_dir:
|
100
|
+
|
101
|
+
# boot_files
|
102
|
+
#
|
103
|
+
# Return an array of filepaths relative to boot_dir to include in order to boot Jasmine
|
104
|
+
# Default: Built in boot file
|
105
|
+
#
|
106
|
+
# EXAMPLE
|
107
|
+
#
|
108
|
+
# boot_files:
|
109
|
+
# - '**/*.js'
|
110
|
+
#
|
111
|
+
boot_files:
|
112
|
+
|
113
|
+
# rack_options
|
114
|
+
#
|
115
|
+
# Extra options to be passed to the rack server
|
116
|
+
# by default, Port and AccessLog are passed.
|
117
|
+
#
|
118
|
+
# This is an advanced options, and left empty by default
|
119
|
+
#
|
120
|
+
# EXAMPLE
|
121
|
+
#
|
122
|
+
# rack_options:
|
123
|
+
# server: 'thin'
|
124
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#Use this file to set/override Jasmine configuration options
|
2
|
+
#You can remove it if you don't need it.
|
3
|
+
#This file is loaded *after* jasmine.yml is interpreted.
|
4
|
+
#
|
5
|
+
#Example: using a different boot file.
|
6
|
+
#Jasmine.configure do |config|
|
7
|
+
# config.boot_dir = '/absolute/path/to/boot_dir'
|
8
|
+
# config.boot_files = lambda { ['/absolute/path/to/boot_dir/file.js'] }
|
9
|
+
#end
|
10
|
+
#
|
11
|
+
#Example: prevent PhantomJS auto install, uses PhantomJS already on your path.
|
12
|
+
#Jasmine.configure do |config|
|
13
|
+
# config.prevent_phantom_js_auto_install = true
|
14
|
+
#end
|
15
|
+
#
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
module RakeHelper
|
4
|
+
def load_rake_environment(files)
|
5
|
+
@rake = Rake::Application.new
|
6
|
+
Rake.application = @rake
|
7
|
+
Rake::Task.define_task(:environment)
|
8
|
+
files.each {|file| load file}
|
9
|
+
end
|
10
|
+
|
11
|
+
def run_task(task)
|
12
|
+
capture_stdout_stderr do
|
13
|
+
@rake[task].invoke
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# saves original $stdout in variable
|
18
|
+
# set $stdout as local instance of StringIO
|
19
|
+
# yields to code execution
|
20
|
+
# returns the local instance of StringIO
|
21
|
+
# resets $stdout to original value
|
22
|
+
def capture_stdout_stderr
|
23
|
+
out = StringIO.new
|
24
|
+
err = StringIO.new
|
25
|
+
$stdout = out
|
26
|
+
$stderr = err
|
27
|
+
begin
|
28
|
+
yield
|
29
|
+
rescue SystemExit => e
|
30
|
+
puts "error = #{e.inspect}"
|
31
|
+
end
|
32
|
+
return "Output: #{out.string}\n Errors:#{err.string}"
|
33
|
+
ensure
|
34
|
+
$stdout = STDOUT
|
35
|
+
$stdout = STDERR
|
36
|
+
end
|
37
|
+
|
38
|
+
RSpec.configure do |config|
|
39
|
+
config.include RakeHelper
|
40
|
+
end
|
41
|
+
end
|
@@ -8,39 +8,69 @@ describe 'browse_everything/_file.html.erb', type: :view do
|
|
8
8
|
'file.m4v', 1024*1024*1024, Time.now, false
|
9
9
|
)
|
10
10
|
}
|
11
|
+
let(:container) {
|
12
|
+
BrowseEverything::FileEntry.new(
|
13
|
+
'dir_id_01234', 'my_provider:/location/pa/th/dir',
|
14
|
+
'dir', 0, Time.now, true
|
15
|
+
)
|
16
|
+
}
|
11
17
|
let(:provider) { double("provider") }
|
12
18
|
let(:page) { Capybara::Node::Simple.new(rendered) }
|
13
19
|
|
14
20
|
|
15
21
|
before do
|
16
22
|
allow(view).to receive(:browse_everything_engine).and_return(BrowseEverything::Engine.routes.url_helpers)
|
17
|
-
allow(view).to receive(:file).and_return(file)
|
18
23
|
allow(view).to receive(:provider).and_return(provider)
|
19
24
|
allow(view).to receive(:path).and_return("path")
|
20
25
|
allow(view).to receive(:parent).and_return("parent")
|
21
26
|
allow(view).to receive(:provider_name).and_return("my provider")
|
22
27
|
allow(provider).to receive(:config).and_return(config)
|
23
|
-
render
|
24
28
|
end
|
25
29
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
+
describe "a file" do
|
31
|
+
before do
|
32
|
+
allow(view).to receive(:file).and_return(file)
|
33
|
+
render
|
34
|
+
end
|
35
|
+
context "file not too big" do
|
36
|
+
let(:config) { { max_upload_file_size: (5*1024*1024*1024) } }
|
37
|
+
it "should draw link" do
|
38
|
+
expect(page).to have_selector("a.ev-link")
|
39
|
+
end
|
30
40
|
end
|
31
|
-
end
|
32
41
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
42
|
+
context "max not configured" do
|
43
|
+
let(:config) { { } }
|
44
|
+
it "should draw link" do
|
45
|
+
expect(page).to have_selector("a.ev-link")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "file too big" do
|
50
|
+
let(:config) { { max_upload_file_size: 1024 } }
|
51
|
+
it "should draw link" do
|
52
|
+
expect(page).not_to have_selector("a.ev-link")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "multi-select" do
|
57
|
+
let(:config) { { } }
|
58
|
+
it "should not have a checkbox" do
|
59
|
+
expect(page).not_to have_selector("input.ev-select-all")
|
60
|
+
end
|
37
61
|
end
|
38
62
|
end
|
39
63
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
64
|
+
describe "a directory" do
|
65
|
+
before do
|
66
|
+
allow(view).to receive(:file).and_return(container)
|
67
|
+
render
|
68
|
+
end
|
69
|
+
context "multi-select" do
|
70
|
+
let(:config) { { } }
|
71
|
+
it "should have the select-all checkbox" do
|
72
|
+
expect(page).to have_selector("input.ev-select-all")
|
73
|
+
end
|
44
74
|
end
|
45
75
|
end
|
46
76
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: browse-everything
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carolyn Cole
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2015-10-
|
16
|
+
date: 2015-10-21 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: rails
|
@@ -337,6 +337,20 @@ dependencies:
|
|
337
337
|
- - ">="
|
338
338
|
- !ruby/object:Gem::Version
|
339
339
|
version: '0'
|
340
|
+
- !ruby/object:Gem::Dependency
|
341
|
+
name: jasmine
|
342
|
+
requirement: !ruby/object:Gem::Requirement
|
343
|
+
requirements:
|
344
|
+
- - "~>"
|
345
|
+
- !ruby/object:Gem::Version
|
346
|
+
version: '2.3'
|
347
|
+
type: :development
|
348
|
+
prerelease: false
|
349
|
+
version_requirements: !ruby/object:Gem::Requirement
|
350
|
+
requirements:
|
351
|
+
- - "~>"
|
352
|
+
- !ruby/object:Gem::Version
|
353
|
+
version: '2.3'
|
340
354
|
description: AJAX/Rails engine file browser for cloud storage services
|
341
355
|
email:
|
342
356
|
- cam156@psu.edu
|
@@ -401,10 +415,16 @@ files:
|
|
401
415
|
- spec/fixtures/file_system/file_1.pdf
|
402
416
|
- spec/fixtures/vcr_cassettes/dropbox.yml
|
403
417
|
- spec/fixtures/vcr_cassettes/retriever.yml
|
418
|
+
- spec/javascripts/behavior_spec.js
|
419
|
+
- spec/javascripts/helpers/jasmine-jquery.js
|
420
|
+
- spec/javascripts/jasmine_spec.rb
|
421
|
+
- spec/javascripts/support/jasmine.yml
|
422
|
+
- spec/javascripts/support/jasmine_helper.rb
|
404
423
|
- spec/spec_helper.rb
|
405
424
|
- spec/support/app/controllers/file_handler_controller.rb
|
406
425
|
- spec/support/app/views/file_handler/index.html.erb
|
407
426
|
- spec/support/app/views/file_handler/main.html.erb
|
427
|
+
- spec/support/rake.rb
|
408
428
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
409
429
|
- spec/unit/base_spec.rb
|
410
430
|
- spec/unit/browse_everything_helper_spec.rb
|
@@ -452,10 +472,16 @@ test_files:
|
|
452
472
|
- spec/fixtures/file_system/file_1.pdf
|
453
473
|
- spec/fixtures/vcr_cassettes/dropbox.yml
|
454
474
|
- spec/fixtures/vcr_cassettes/retriever.yml
|
475
|
+
- spec/javascripts/behavior_spec.js
|
476
|
+
- spec/javascripts/helpers/jasmine-jquery.js
|
477
|
+
- spec/javascripts/jasmine_spec.rb
|
478
|
+
- spec/javascripts/support/jasmine.yml
|
479
|
+
- spec/javascripts/support/jasmine_helper.rb
|
455
480
|
- spec/spec_helper.rb
|
456
481
|
- spec/support/app/controllers/file_handler_controller.rb
|
457
482
|
- spec/support/app/views/file_handler/index.html.erb
|
458
483
|
- spec/support/app/views/file_handler/main.html.erb
|
484
|
+
- spec/support/rake.rb
|
459
485
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
460
486
|
- spec/unit/base_spec.rb
|
461
487
|
- spec/unit/browse_everything_helper_spec.rb
|