sections_rails 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/sections_rails/partial_parser.rb +2 -9
- data/lib/sections_rails/version.rb +1 -1
- data/spec/dummy/log/test.log +864 -442
- data/spec/dummy/tmp/cache/assets/test/sprockets/07debd2f5bdd0945f151e2b19446f044 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/08f27e536dfd0bf16e287507b2acf9cd +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/0fca8ebe3afdfe78547af6286f823282 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/1b3072864335229a30962921e232e038 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/1e3b95f4fb7349356a18d5d6c25a03c5 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/1ef0ad5f3bf9347ff721cc9adb7ac475 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/22ca9b4c7a72cecb6e5bd86aeb2cbe1a +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/23a710a5152e77b9f6093d0ff6132cbb +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2760c50c86bfb006436f3b08f7f86d50 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/27cd0623d0c7bf548c06891f9ff3a7fe +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2883d6642cddc16b7cbec8a10d604e1f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/43f23e226a6cf9111462a1de5a4141c9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4469f565cbeb63b8a9dd57c772a0063f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4bfa702f177bb40d4add4fa2cdc56290 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/620334e6045e81791d00cfc3d5880e99 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/778cbfb3c3494e0a1bff25acec1acb41 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/88172c7017f9d54036e04229e5aeb7a9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/9f1946f74976325823cd17e3344ac99e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a1675ac0cfcd39baa9de6cd3800ed7d8 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a5d83488b94f2eb72952aead38dff3e3 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a6fce1b02a415f12102f90ede73a4466 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ab9a16c02e5840aa2caa410053c6d992 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ad63aa5b66774feeab4dc6bcf5cd62ba +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b4e4bd3378cc31d280c2f1e817d7e563 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b55f94acb73aef21cd0314d38e7154d1 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b71f97c2f9217932f4105b67a6888f8c +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/bb6a12b80c6bb08c7943f43676e3c85b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c427bfd8150de82240a0e21a09f2555b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c6e5bc7bd239a1911ec2e68129e3de64 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/dca0e46db52c9d8f506520eb6da852d5 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/dfca15e755e57d8cc860d77b907d39f1 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e96fdb62e07b19eed5b0da3f39778ad8 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ea32dd93eace3bc52cef33158a05dff0 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ee731240c77f9d385c44692245a14659 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f05f533e9d84fde309ea83909d9ce528 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f4e42345683e627f5c3ddbed7b0f3003 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f5d263c951494ab0fb39fe65f211ea9d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/fb9a65051eb9d735f3634545d153a9eb +0 -0
- data/spec/sections_rails/partial_parser_spec.rb +4 -0
- data/spec/sections_rails/section_spec.rb +24 -24
- metadata +2 -22
- data/spec/dummy/tmp/cache/assets/test/sprockets/bfc23365a5a3cb4ce2a38dd7b50abeca +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/dd2347a11d964f59eb8abcf66b424f31 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e872fbd8d31bbedfb2ecc12112c87f20 +0 -0
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -35,6 +35,10 @@ describe SectionsRails::PartialParser do
|
|
35
35
|
expect(SectionsRails::PartialParser.find_sections(' = section :alpha')).to eq ['alpha']
|
36
36
|
end
|
37
37
|
|
38
|
+
it 'finds HAML sections after a tag' do
|
39
|
+
expect(SectionsRails::PartialParser.find_sections('li= section :alpha')).to eq ['alpha']
|
40
|
+
end
|
41
|
+
|
38
42
|
it 'finds HAML sections with parameters' do
|
39
43
|
expect(SectionsRails::PartialParser.find_sections('= section "alpha", css: false')).to eq ['alpha']
|
40
44
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe SectionsRails::Section do
|
4
|
-
before(:each) { Rails.
|
4
|
+
before(:each) { allow(Rails).to receive(:root).and_return('/rails_root/') }
|
5
5
|
subject { SectionsRails::Section.new 'folder/section', nil }
|
6
6
|
|
7
7
|
describe 'initialize' do
|
@@ -25,10 +25,10 @@ describe SectionsRails::Section do
|
|
25
25
|
its(:asset_filepath) { should == 'app/sections/folder/section/section' }
|
26
26
|
its(:asset_includepath) { should == 'folder/section/section' }
|
27
27
|
its(:partial_filepath) { should == 'app/sections/folder/section/_section' }
|
28
|
-
it { subject.partial_filepath('foo').
|
28
|
+
it { expect(subject.partial_filepath('foo')).to eq 'app/sections/folder/section/_foo' }
|
29
29
|
its(:partial_includepath) { should == 'folder/section/section' }
|
30
30
|
its(:partial_renderpath) { should == 'folder/section/section' }
|
31
|
-
it { subject.partial_renderpath('foo').
|
31
|
+
it { expect(subject.partial_renderpath('foo')).to eq 'folder/section/foo' }
|
32
32
|
end
|
33
33
|
|
34
34
|
context 'section in root sections directory' do
|
@@ -44,30 +44,30 @@ describe SectionsRails::Section do
|
|
44
44
|
describe 'find_js_includepath' do
|
45
45
|
|
46
46
|
it 'tries all different JS asset file types for sections' do
|
47
|
-
File.
|
48
|
-
File.
|
49
|
-
File.
|
47
|
+
expect(File).to receive(:exists?).with("app/sections/folder/section/section.js").and_return(false)
|
48
|
+
expect(File).to receive(:exists?).with("app/sections/folder/section/section.js.coffee").and_return(false)
|
49
|
+
expect(File).to receive(:exists?).with("app/sections/folder/section/section.coffee").and_return(false)
|
50
50
|
subject.find_js_includepath
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'returns nil if there is no known JS asset file' do
|
54
|
-
File.
|
54
|
+
allow(File).to receive(:exists?).and_return(false)
|
55
55
|
expect(subject.find_js_includepath).to be_nil
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'returns the asset path of the JS asset' do
|
59
|
-
File.
|
59
|
+
allow(File).to receive(:exists?).and_return(true)
|
60
60
|
expect(subject.find_js_includepath).to eql 'folder/section/section'
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'returns nil if the file exists but the section has JS assets disabled' do
|
64
|
-
File.
|
64
|
+
allow(File).to receive(:exists?).and_return(true)
|
65
65
|
section = SectionsRails::Section.new 'folder/section', nil, js: false
|
66
66
|
expect(section.find_js_includepath).to be_nil
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'returns the custom JS asset path if one is set' do
|
70
|
-
File.
|
70
|
+
allow(File).to receive(:exists?).and_return(true)
|
71
71
|
section = SectionsRails::Section.new 'folder/section', nil, js: 'custom'
|
72
72
|
expect(section.find_js_includepath).to eql 'custom'
|
73
73
|
end
|
@@ -77,19 +77,19 @@ describe SectionsRails::Section do
|
|
77
77
|
describe 'find_partial_renderpath' do
|
78
78
|
|
79
79
|
it 'looks for all known types of partials' do
|
80
|
-
File.
|
81
|
-
File.
|
82
|
-
File.
|
80
|
+
expect(File).to receive(:exists?).with("app/sections/folder/section/_section.html.erb").and_return(false)
|
81
|
+
expect(File).to receive(:exists?).with("app/sections/folder/section/_section.html.haml").and_return(false)
|
82
|
+
expect(File).to receive(:exists?).with("app/sections/folder/section/_section.html.slim").and_return(false)
|
83
83
|
subject.find_partial_renderpath
|
84
84
|
end
|
85
85
|
|
86
86
|
it "returns nil if it doesn't find any assets" do
|
87
|
-
File.
|
87
|
+
allow(File).to receive(:exists?).and_return(false)
|
88
88
|
expect(subject.find_partial_renderpath).to be_falsy
|
89
89
|
end
|
90
90
|
|
91
91
|
it "returns the path for rendering of the asset if it finds one" do
|
92
|
-
File.
|
92
|
+
allow(File).to receive(:exists?).and_return(true)
|
93
93
|
expect(subject.find_partial_renderpath).to eql 'folder/section/section'
|
94
94
|
end
|
95
95
|
end
|
@@ -98,19 +98,19 @@ describe SectionsRails::Section do
|
|
98
98
|
describe 'find_partial_filepath' do
|
99
99
|
|
100
100
|
it 'looks for all known types of partials' do
|
101
|
-
File.
|
102
|
-
File.
|
103
|
-
File.
|
101
|
+
expect(File).to receive(:exists?).with("app/sections/folder/section/_section.html.erb").and_return(false)
|
102
|
+
expect(File).to receive(:exists?).with("app/sections/folder/section/_section.html.haml").and_return(false)
|
103
|
+
expect(File).to receive(:exists?).with("app/sections/folder/section/_section.html.slim").and_return(false)
|
104
104
|
subject.find_partial_filepath
|
105
105
|
end
|
106
106
|
|
107
107
|
it "returns nil if it doesn't find any assets" do
|
108
|
-
File.
|
108
|
+
allow(File).to receive(:exists?).and_return(false)
|
109
109
|
expect(subject.find_partial_filepath).to be_falsy
|
110
110
|
end
|
111
111
|
|
112
112
|
it "returns the absolute path to the asset if it finds one" do
|
113
|
-
File.
|
113
|
+
allow(File).to receive(:exists?).and_return(true)
|
114
114
|
expect(subject.find_partial_filepath).to eql 'app/sections/folder/section/_section.html.erb'
|
115
115
|
end
|
116
116
|
end
|
@@ -118,8 +118,8 @@ describe SectionsRails::Section do
|
|
118
118
|
|
119
119
|
describe 'partial_content' do
|
120
120
|
it 'returns the content of the partial if one exists' do
|
121
|
-
SectionsRails::Section.new('partial_content/erb_partial').partial_content.strip.
|
122
|
-
SectionsRails::Section.new('partial_content/haml_partial').partial_content.strip.
|
121
|
+
expect(SectionsRails::Section.new('partial_content/erb_partial').partial_content.strip).to eq 'ERB partial content'
|
122
|
+
expect(SectionsRails::Section.new('partial_content/haml_partial').partial_content.strip).to eq 'HAML partial content'
|
123
123
|
end
|
124
124
|
|
125
125
|
it 'returns nil if no partial exists' do
|
@@ -130,8 +130,8 @@ describe SectionsRails::Section do
|
|
130
130
|
describe 'referenced_sections' do
|
131
131
|
|
132
132
|
it 'returns the sections that are referenced in the section partial' do
|
133
|
-
SectionsRails::Section.new('referenced_sections/erb_partial').referenced_sections.
|
134
|
-
SectionsRails::Section.new('referenced_sections/haml_partial').referenced_sections.
|
133
|
+
expect(SectionsRails::Section.new('referenced_sections/erb_partial').referenced_sections).to eq ['one', 'two/three']
|
134
|
+
expect(SectionsRails::Section.new('referenced_sections/haml_partial').referenced_sections).to eq ['one', 'two/three']
|
135
135
|
end
|
136
136
|
|
137
137
|
it 'returns an empty array if there is no partial' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sections_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Goslar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: coffee-rails
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: sass-rails
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,13 +192,10 @@ files:
|
|
206
192
|
- spec/dummy/tmp/cache/assets/test/sprockets/b55f94acb73aef21cd0314d38e7154d1
|
207
193
|
- spec/dummy/tmp/cache/assets/test/sprockets/b71f97c2f9217932f4105b67a6888f8c
|
208
194
|
- spec/dummy/tmp/cache/assets/test/sprockets/bb6a12b80c6bb08c7943f43676e3c85b
|
209
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/bfc23365a5a3cb4ce2a38dd7b50abeca
|
210
195
|
- spec/dummy/tmp/cache/assets/test/sprockets/c427bfd8150de82240a0e21a09f2555b
|
211
196
|
- spec/dummy/tmp/cache/assets/test/sprockets/c6e5bc7bd239a1911ec2e68129e3de64
|
212
197
|
- spec/dummy/tmp/cache/assets/test/sprockets/dca0e46db52c9d8f506520eb6da852d5
|
213
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/dd2347a11d964f59eb8abcf66b424f31
|
214
198
|
- spec/dummy/tmp/cache/assets/test/sprockets/dfca15e755e57d8cc860d77b907d39f1
|
215
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/e872fbd8d31bbedfb2ecc12112c87f20
|
216
199
|
- spec/dummy/tmp/cache/assets/test/sprockets/e96fdb62e07b19eed5b0da3f39778ad8
|
217
200
|
- spec/dummy/tmp/cache/assets/test/sprockets/ea32dd93eace3bc52cef33158a05dff0
|
218
201
|
- spec/dummy/tmp/cache/assets/test/sprockets/ee731240c77f9d385c44692245a14659
|
@@ -341,13 +324,10 @@ test_files:
|
|
341
324
|
- spec/dummy/tmp/cache/assets/test/sprockets/b55f94acb73aef21cd0314d38e7154d1
|
342
325
|
- spec/dummy/tmp/cache/assets/test/sprockets/b71f97c2f9217932f4105b67a6888f8c
|
343
326
|
- spec/dummy/tmp/cache/assets/test/sprockets/bb6a12b80c6bb08c7943f43676e3c85b
|
344
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/bfc23365a5a3cb4ce2a38dd7b50abeca
|
345
327
|
- spec/dummy/tmp/cache/assets/test/sprockets/c427bfd8150de82240a0e21a09f2555b
|
346
328
|
- spec/dummy/tmp/cache/assets/test/sprockets/c6e5bc7bd239a1911ec2e68129e3de64
|
347
329
|
- spec/dummy/tmp/cache/assets/test/sprockets/dca0e46db52c9d8f506520eb6da852d5
|
348
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/dd2347a11d964f59eb8abcf66b424f31
|
349
330
|
- spec/dummy/tmp/cache/assets/test/sprockets/dfca15e755e57d8cc860d77b907d39f1
|
350
|
-
- spec/dummy/tmp/cache/assets/test/sprockets/e872fbd8d31bbedfb2ecc12112c87f20
|
351
331
|
- spec/dummy/tmp/cache/assets/test/sprockets/e96fdb62e07b19eed5b0da3f39778ad8
|
352
332
|
- spec/dummy/tmp/cache/assets/test/sprockets/ea32dd93eace3bc52cef33158a05dff0
|
353
333
|
- spec/dummy/tmp/cache/assets/test/sprockets/ee731240c77f9d385c44692245a14659
|
Binary file
|
Binary file
|
Binary file
|