dassets 0.14.5 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,35 +1,37 @@
1
- require 'assert'
2
- require 'dassets/source'
1
+ require "assert"
2
+ require "dassets/source"
3
3
 
4
- require 'dassets/engine'
4
+ require "dassets/engine"
5
5
 
6
6
  class Dassets::Source
7
-
8
7
  class UnitTests < Assert::Context
9
8
  desc "Dassets::Source"
9
+ subject { Dassets::Source.new(@source_path) }
10
+
10
11
  setup do
11
12
  @source_path = TEST_SUPPORT_PATH.join("source_files")
12
- @source = Dassets::Source.new(@source_path)
13
13
  end
14
- subject{ @source }
15
14
 
16
15
  should have_reader :path, :engines, :response_headers
17
16
  should have_imeth :files, :filter, :engine
18
17
 
19
18
  should "know its path and default filter" do
20
- assert_equal @source_path.to_s, subject.path
21
- assert_kind_of Proc, subject.filter
22
- assert_equal ['file1', 'file2'], subject.filter.call(['file1', 'file2'])
19
+ assert_that(subject.path).equals(@source_path.to_s)
20
+ assert_that(subject.filter).is_kind_of(Proc)
21
+ assert_that(subject.filter.call(["file1", "file2"]))
22
+ .equals(["file1", "file2"])
23
23
  end
24
24
 
25
25
  should "know its files" do
26
26
  exp_files = [
27
- @source_path.join('test1.txt').to_s,
28
- @source_path.join('_ignored.txt').to_s,
29
- @source_path.join('nested/test2.txt').to_s,
30
- @source_path.join('nested/_nested_ignored.txt').to_s
27
+ @source_path.join("test1.txt").to_s,
28
+ @source_path.join("_ignored.txt").to_s,
29
+ @source_path.join("nested/test2.txt").to_s,
30
+ @source_path.join("nested/_nested_ignored.txt").to_s,
31
+ @source_path.join("linked/linked_file.txt").to_s,
32
+ @source_path.join("linked_file2.txt").to_s,
31
33
  ].sort
32
- assert_equal exp_files, subject.files
34
+ assert_that(subject.files).equals(exp_files)
33
35
  end
34
36
 
35
37
  should "run the supplied source filter on the paths" do
@@ -37,30 +39,33 @@ class Dassets::Source
37
39
  paths.reject{ |path| File.basename(path) =~ /^_/ }
38
40
  end
39
41
  exp_files = [
40
- @source_path.join('test1.txt').to_s,
41
- @source_path.join('nested/test2.txt').to_s,
42
+ @source_path.join("test1.txt").to_s,
43
+ @source_path.join("nested/test2.txt").to_s,
44
+ @source_path.join("linked/linked_file.txt").to_s,
45
+ @source_path.join("linked_file2.txt").to_s,
42
46
  ].sort
43
47
 
44
- assert_equal exp_files, subject.files
48
+ assert_that(subject.files).equals(exp_files)
45
49
  end
46
50
 
47
- should "know its engines and return a NullEngine by default" do
48
- assert_kind_of ::Hash, subject.engines
49
- assert_kind_of Dassets::NullEngine, subject.engines['something']
51
+ should "know its extension-specific engines and return an empty Array by "\
52
+ "default" do
53
+ assert_that(subject.engines).is_kind_of(::Hash)
54
+ assert_that(subject.engines["something"]).equals([])
50
55
  end
51
56
 
52
57
  should "know its response headers" do
53
- assert_equal Hash.new, subject.response_headers
58
+ assert_that(subject.response_headers).equals(Hash.new)
54
59
 
55
60
  name, value = Factory.string, Factory.string
56
61
  subject.response_headers[name] = value
57
- assert_equal value, subject.response_headers[name]
62
+ assert_that(subject.response_headers[name]).equals(value)
58
63
  end
59
-
60
64
  end
61
65
 
62
66
  class EmptySourceTests < UnitTests
63
67
  desc "with no source files"
68
+
64
69
  setup do
65
70
  @empty_source_path = TEST_SUPPORT_PATH.join("empty")
66
71
  @empty_source = Dassets::Source.new(@empty_source_path)
@@ -70,8 +75,8 @@ class Dassets::Source
70
75
  end
71
76
 
72
77
  should "have no files" do
73
- assert_empty @empty_source.files
74
- assert_empty @no_exist_source.files
78
+ assert_that(@empty_source.files).is_empty
79
+ assert_that(@no_exist_source.files).is_empty
75
80
  end
76
81
 
77
82
  should "hand filters an empty path list" do
@@ -82,47 +87,50 @@ class Dassets::Source
82
87
  paths.reject{ |path| File.basename(path) =~ /^_/ }
83
88
  end
84
89
 
85
- assert_empty @empty_source.files
86
- assert_empty @no_exist_source.files
90
+ assert_that(@empty_source.files).is_empty
91
+ assert_that(@no_exist_source.files).is_empty
87
92
  end
88
-
89
93
  end
90
94
 
91
95
  class EngineRegistrationTests < UnitTests
92
96
  desc "when registering an engine"
97
+
93
98
  setup do
94
- @empty_engine = Class.new(Dassets::Engine) do
95
- def ext(input_ext); ''; end
96
- def compile(input); ''; end
97
- end
99
+ @empty_engine =
100
+ Class.new(Dassets::Engine) do
101
+ def ext(input_ext); ""; end
102
+ def compile(input); ""; end
103
+ end
98
104
  end
99
105
 
100
106
  should "allow registering new engines" do
101
- assert_kind_of Dassets::NullEngine, subject.engines['empty']
102
- subject.engine 'empty', @empty_engine, 'an' => 'opt'
103
- assert_kind_of @empty_engine, subject.engines['empty']
104
- assert_equal 'opt', subject.engines['empty'].opts['an']
105
- assert_equal '', subject.engines['empty'].ext('empty')
106
- assert_equal '', subject.engines['empty'].compile('some content')
107
+ assert_that(subject.engines["empty"]).equals([])
108
+
109
+ subject.engine "empty", @empty_engine, "an" => "opt"
110
+ assert_that(subject.engines["empty"]).is_kind_of(Array)
111
+ assert_that(subject.engines["empty"].size).equals(1)
112
+ assert_that(subject.engines["empty"].first.opts["an"]).equals("opt")
113
+ assert_that(subject.engines["empty"].first.ext("empty")).equals("")
114
+ assert_that(subject.engines["empty"].first.compile("some content")).equals("")
107
115
  end
108
116
 
109
117
  should "register with the source path as a default option" do
110
- subject.engine 'empty', @empty_engine
111
- exp_opts = { 'source_path' => subject.path }
112
- assert_equal exp_opts, subject.engines['empty'].opts
118
+ subject.engine "empty", @empty_engine
119
+ exp_opts = { "source_path" => subject.path }
120
+ assert_that(subject.engines["empty"].first.opts).equals(exp_opts)
113
121
 
114
- subject.engine 'empty', @empty_engine, 'an' => 'opt'
122
+ subject.engines["empty"] = []
123
+ subject.engine "empty", @empty_engine, "an" => "opt"
115
124
  exp_opts = {
116
- 'source_path' => subject.path,
117
- 'an' => 'opt'
125
+ "source_path" => subject.path,
126
+ "an" => "opt"
118
127
  }
119
- assert_equal exp_opts, subject.engines['empty'].opts
128
+ assert_that(subject.engines["empty"].first.opts).equals(exp_opts)
120
129
 
121
- subject.engine 'empty', @empty_engine, 'source_path' => 'something'
122
- exp_opts = { 'source_path' => 'something' }
123
- assert_equal exp_opts, subject.engines['empty'].opts
130
+ subject.engines["empty"] = []
131
+ subject.engine "empty", @empty_engine, "source_path" => "something"
132
+ exp_opts = { "source_path" => "something" }
133
+ assert_that(subject.engines["empty"].first.opts).equals(exp_opts)
124
134
  end
125
-
126
135
  end
127
-
128
136
  end
metadata CHANGED
@@ -1,69 +1,82 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: dassets
3
- version: !ruby/object:Gem::Version
4
- version: 0.14.5
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.15.0
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Kelly Redding
8
8
  - Collin Redding
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2017-09-28 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2020-12-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: assert
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- requirements:
20
- - - ~>
21
- - !ruby/object:Gem::Version
22
- version: 2.16.3
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 2.19.0
23
21
  type: :development
24
- version_requirements: *id001
25
- - !ruby/object:Gem::Dependency
26
- name: assert-rack-test
27
22
  prerelease: false
28
- requirement: &id002 !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ~>
31
- - !ruby/object:Gem::Version
32
- version: 1.0.5
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 2.19.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: assert-rack-test
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 1.1.0
33
35
  type: :development
34
- version_requirements: *id002
35
- - !ruby/object:Gem::Dependency
36
- name: sinatra
37
36
  prerelease: false
38
- requirement: &id003 !ruby/object:Gem::Requirement
39
- requirements:
40
- - - ~>
41
- - !ruby/object:Gem::Version
42
- version: "1.4"
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 1.1.0
42
+ - !ruby/object:Gem::Dependency
43
+ name: sinatra
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '2.1'
43
49
  type: :development
44
- version_requirements: *id003
45
- - !ruby/object:Gem::Dependency
46
- name: rack
47
50
  prerelease: false
48
- requirement: &id004 !ruby/object:Gem::Requirement
49
- requirements:
50
- - - ~>
51
- - !ruby/object:Gem::Version
52
- version: "1.0"
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '2.1'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rack
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '2.1'
53
63
  type: :runtime
54
- version_requirements: *id004
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '2.1'
55
70
  description: Digest and serve HTML asset files
56
- email:
71
+ email:
57
72
  - kelly@kellyredding.com
58
73
  - collin.redding@me.com
59
74
  executables: []
60
-
61
75
  extensions: []
62
-
63
76
  extra_rdoc_files: []
64
-
65
- files:
66
- - .gitignore
77
+ files:
78
+ - ".gitignore"
79
+ - ".ruby-version"
67
80
  - Gemfile
68
81
  - LICENSE
69
82
  - README.md
@@ -91,7 +104,10 @@ files:
91
104
  - test/support/app/assets/nested/file3.txt
92
105
  - test/support/empty/.gitkeep
93
106
  - test/support/factory.rb
107
+ - test/support/linked_source_files/linked_file.txt
94
108
  - test/support/source_files/_ignored.txt
109
+ - test/support/source_files/linked
110
+ - test/support/source_files/linked_file2.txt
95
111
  - test/support/source_files/nested/_nested_ignored.txt
96
112
  - test/support/source_files/nested/test2.txt
97
113
  - test/support/source_files/test1.txt
@@ -110,32 +126,29 @@ files:
110
126
  - test/unit/source_tests.rb
111
127
  - tmp/.gitkeep
112
128
  homepage: http://github.com/redding/dassets
113
- licenses:
129
+ licenses:
114
130
  - MIT
115
131
  metadata: {}
116
-
117
132
  post_install_message:
118
133
  rdoc_options: []
119
-
120
- require_paths:
134
+ require_paths:
121
135
  - lib
122
- required_ruby_version: !ruby/object:Gem::Requirement
123
- requirements:
124
- - &id005
125
- - ">="
126
- - !ruby/object:Gem::Version
127
- version: "0"
128
- required_rubygems_version: !ruby/object:Gem::Requirement
129
- requirements:
130
- - *id005
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - "~>"
139
+ - !ruby/object:Gem::Version
140
+ version: '2.5'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
131
146
  requirements: []
132
-
133
- rubyforge_project:
134
- rubygems_version: 2.6.6
147
+ rubygems_version: 3.1.2
135
148
  signing_key:
136
149
  specification_version: 4
137
150
  summary: Digested asset files
138
- test_files:
151
+ test_files:
139
152
  - test/helper.rb
140
153
  - test/support/app.rb
141
154
  - test/support/app/assets/file1.txt
@@ -145,7 +158,10 @@ test_files:
145
158
  - test/support/app/assets/nested/file3.txt
146
159
  - test/support/empty/.gitkeep
147
160
  - test/support/factory.rb
161
+ - test/support/linked_source_files/linked_file.txt
148
162
  - test/support/source_files/_ignored.txt
163
+ - test/support/source_files/linked
164
+ - test/support/source_files/linked_file2.txt
149
165
  - test/support/source_files/nested/_nested_ignored.txt
150
166
  - test/support/source_files/nested/test2.txt
151
167
  - test/support/source_files/test1.txt