sections_rails 0.6.10 → 0.6.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/lib/sections_rails/section.rb +60 -30
  2. data/lib/sections_rails/version.rb +1 -1
  3. data/spec/controllers/errors_controller_spec.rb +15 -0
  4. data/spec/controllers/partials_controller_spec.rb +74 -0
  5. data/spec/controllers/script_assets_controller_spec.rb +68 -0
  6. data/spec/controllers/style_assets_controller_spec.rb +82 -0
  7. data/spec/controllers/view_types_controller_spec.rb +22 -0
  8. data/spec/dummy/app/assets/images/rails.png +0 -0
  9. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  10. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  11. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  12. data/spec/dummy/app/controllers/errors_controller.rb +5 -0
  13. data/spec/dummy/app/controllers/partials_controller.rb +20 -0
  14. data/spec/dummy/app/controllers/script_assets_controller.rb +18 -0
  15. data/spec/dummy/app/controllers/style_assets_controller.rb +27 -0
  16. data/spec/dummy/app/controllers/view_types_controller.rb +10 -0
  17. data/spec/dummy/app/views/errors/missing_section.html.erb +1 -0
  18. data/spec/dummy/app/views/layouts/application.html.erb +1 -0
  19. data/spec/dummy/app/views/partials/custom_partial.html.erb +1 -0
  20. data/spec/dummy/app/views/partials/disabled.html.erb +2 -0
  21. data/spec/dummy/app/views/partials/erb_section.html.erb +1 -0
  22. data/spec/dummy/app/views/partials/haml_section.html.erb +1 -0
  23. data/spec/dummy/app/views/partials/no_options.html.erb +1 -0
  24. data/spec/dummy/app/views/partials/production_mode.html.erb +1 -0
  25. data/spec/dummy/app/views/script_assets/coffeescript.html.erb +1 -0
  26. data/spec/dummy/app/views/script_assets/custom_script.html.erb +1 -0
  27. data/spec/dummy/app/views/script_assets/javascript.html.erb +1 -0
  28. data/spec/dummy/app/views/script_assets/no_script.html.erb +2 -0
  29. data/spec/dummy/app/views/script_assets/production_mode.html.erb +1 -0
  30. data/spec/dummy/app/views/style_assets/css.html.erb +1 -0
  31. data/spec/dummy/app/views/style_assets/css_sass.html.erb +1 -0
  32. data/spec/dummy/app/views/style_assets/css_scss.html.erb +1 -0
  33. data/spec/dummy/app/views/style_assets/custom_style.html.erb +1 -0
  34. data/spec/dummy/app/views/style_assets/no_style.html.erb +2 -0
  35. data/spec/dummy/app/views/style_assets/production_mode.html.erb +1 -0
  36. data/spec/dummy/app/views/style_assets/sass.html.erb +1 -0
  37. data/spec/dummy/app/views/style_assets/scss.html.erb +1 -0
  38. data/spec/dummy/app/views/view_types/erb.html.erb +1 -0
  39. data/spec/dummy/app/views/view_types/haml.html.haml +1 -0
  40. data/spec/dummy/config.ru +4 -0
  41. data/spec/dummy/config/application.rb +18 -0
  42. data/spec/dummy/config/boot.rb +7 -0
  43. data/spec/dummy/config/environment.rb +5 -0
  44. data/spec/dummy/config/environments/development.rb +27 -0
  45. data/spec/dummy/config/environments/test.rb +37 -0
  46. data/spec/dummy/config/initializers/sections_rails.rb +0 -0
  47. data/spec/dummy/config/routes.rb +4 -0
  48. data/spec/dummy/log/development.log +16367 -0
  49. data/spec/dummy/tmp/cache/assets/CB9/B60/sprockets%2Fe7b839a0806e5c20e5018197f56cd656 +0 -0
  50. data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  51. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  52. data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  53. data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  54. data/spec/dummy/tmp/cache/assets/D76/4D0/sprockets%2F8a096b6dd59bfda3e461617a95524eaf +0 -0
  55. data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  56. data/spec/dummy/tmp/cache/assets/DE1/6A0/sprockets%2Fcae9aba95894da8a28fa8a5387dc565f +0 -0
  57. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  58. data/spec/dummy/tmp/cache/assets/E1D/010/sprockets%2Fdffad412d86bfdfbb1f307d711da21d3 +0 -0
  59. data/spec/sections_rails/section_spec.rb +24 -1
  60. data/spec/spec_helper.rb +3 -1
  61. metadata +137 -14
@@ -1,6 +1,5 @@
1
1
  require "spec_helper"
2
2
 
3
- # TODO(SZ): missing specs.
4
3
  describe SectionsRails::Section do
5
4
  before(:each) { Rails.stub(:root).and_return('/rails_root/') }
6
5
  subject { SectionsRails::Section.new 'folder/section', nil }
@@ -26,7 +25,10 @@ describe SectionsRails::Section do
26
25
  its(:asset_filepath) { should == 'app/sections/folder/section/section' }
27
26
  its(:asset_includepath) { should == 'folder/section/section' }
28
27
  its(:partial_filepath) { should == 'app/sections/folder/section/_section' }
28
+ it { subject.partial_filepath('foo').should == 'app/sections/folder/section/_foo' }
29
29
  its(:partial_includepath) { should == 'folder/section/section' }
30
+ its(:partial_renderpath) { should == 'folder/section/section' }
31
+ it { subject.partial_renderpath('foo').should == 'folder/section/foo' }
30
32
  end
31
33
 
32
34
  context 'section in root sections directory' do
@@ -73,6 +75,27 @@ describe SectionsRails::Section do
73
75
  end
74
76
 
75
77
 
78
+ describe 'find_partial_renderpath' do
79
+
80
+ it 'looks for all known types of partials' do
81
+ File.should_receive(:exists?).with("app/sections/folder/section/_section.html.erb").and_return(false)
82
+ File.should_receive(:exists?).with("app/sections/folder/section/_section.html.haml").and_return(false)
83
+ subject.find_partial_renderpath
84
+ end
85
+
86
+ it "returns nil if it doesn't find any assets" do
87
+ File.should_receive(:exists?).with("app/sections/folder/section/_section.html.erb").and_return(false)
88
+ File.should_receive(:exists?).with("app/sections/folder/section/_section.html.haml").and_return(false)
89
+ subject.find_partial_renderpath.should be_false
90
+ end
91
+
92
+ it "returns the path for rendering of the asset if it finds one" do
93
+ File.stub(:exists?).and_return(true)
94
+ subject.find_partial_renderpath.should == 'folder/section/section'
95
+ end
96
+ end
97
+
98
+
76
99
  describe 'find_partial_filepath' do
77
100
 
78
101
  it 'looks for all known types of partials' do
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,10 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
3
  require 'rails'
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+
4
6
  require 'rspec'
5
- require 'rspec-rails'
7
+ require 'rspec/rails'
6
8
  require 'sections_rails'
7
9
 
8
10
  # Configure Rails Environment
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sections_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.10
4
+ version: 0.6.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-09 00:00:00.000000000 Z
12
+ date: 2012-06-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70295836062580 !ruby/object:Gem::Requirement
16
+ requirement: &70243624962300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70295836062580
24
+ version_requirements: *70243624962300
25
25
  - !ruby/object:Gem::Dependency
26
- name: rspec
27
- requirement: &70295836061920 !ruby/object:Gem::Requirement
26
+ name: haml
27
+ requirement: &70243624961500 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70295836061920
35
+ version_requirements: *70243624961500
36
36
  - !ruby/object:Gem::Dependency
37
- name: sqlite3
38
- requirement: &70295836054500 !ruby/object:Gem::Requirement
37
+ name: rspec-rails
38
+ requirement: &70243624960640 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70295836054500
46
+ version_requirements: *70243624960640
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: guard-rspec
49
- requirement: &70295836053540 !ruby/object:Gem::Requirement
49
+ requirement: &70243624959880 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,21 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70295836053540
57
+ version_requirements: *70243624959880
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rb-fsevent
60
- requirement: &70295836052100 !ruby/object:Gem::Requirement
60
+ requirement: &70243624959300 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70243624959300
69
+ - !ruby/object:Gem::Dependency
70
+ name: sqlite3
71
+ requirement: &70243624954480 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ! '>='
@@ -65,7 +76,7 @@ dependencies:
65
76
  version: '0'
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *70295836052100
79
+ version_requirements: *70243624954480
69
80
  description: Sections_rails adds infrastructure to the view layer of Ruby on Rails.
70
81
  It allows to define and use the HTML, CSS, and JavaScript code of dedicated sections
71
82
  of pages together in one place.
@@ -86,6 +97,62 @@ files:
86
97
  - MIT-LICENSE
87
98
  - Rakefile
88
99
  - README.md
100
+ - spec/controllers/errors_controller_spec.rb
101
+ - spec/controllers/partials_controller_spec.rb
102
+ - spec/controllers/script_assets_controller_spec.rb
103
+ - spec/controllers/style_assets_controller_spec.rb
104
+ - spec/controllers/view_types_controller_spec.rb
105
+ - spec/dummy/app/assets/images/rails.png
106
+ - spec/dummy/app/assets/javascripts/application.js
107
+ - spec/dummy/app/assets/stylesheets/application.css
108
+ - spec/dummy/app/controllers/application_controller.rb
109
+ - spec/dummy/app/controllers/errors_controller.rb
110
+ - spec/dummy/app/controllers/partials_controller.rb
111
+ - spec/dummy/app/controllers/script_assets_controller.rb
112
+ - spec/dummy/app/controllers/style_assets_controller.rb
113
+ - spec/dummy/app/controllers/view_types_controller.rb
114
+ - spec/dummy/app/views/errors/missing_section.html.erb
115
+ - spec/dummy/app/views/layouts/application.html.erb
116
+ - spec/dummy/app/views/partials/custom_partial.html.erb
117
+ - spec/dummy/app/views/partials/disabled.html.erb
118
+ - spec/dummy/app/views/partials/erb_section.html.erb
119
+ - spec/dummy/app/views/partials/haml_section.html.erb
120
+ - spec/dummy/app/views/partials/no_options.html.erb
121
+ - spec/dummy/app/views/partials/production_mode.html.erb
122
+ - spec/dummy/app/views/script_assets/coffeescript.html.erb
123
+ - spec/dummy/app/views/script_assets/custom_script.html.erb
124
+ - spec/dummy/app/views/script_assets/javascript.html.erb
125
+ - spec/dummy/app/views/script_assets/no_script.html.erb
126
+ - spec/dummy/app/views/script_assets/production_mode.html.erb
127
+ - spec/dummy/app/views/style_assets/css.html.erb
128
+ - spec/dummy/app/views/style_assets/css_sass.html.erb
129
+ - spec/dummy/app/views/style_assets/css_scss.html.erb
130
+ - spec/dummy/app/views/style_assets/custom_style.html.erb
131
+ - spec/dummy/app/views/style_assets/no_style.html.erb
132
+ - spec/dummy/app/views/style_assets/production_mode.html.erb
133
+ - spec/dummy/app/views/style_assets/sass.html.erb
134
+ - spec/dummy/app/views/style_assets/scss.html.erb
135
+ - spec/dummy/app/views/view_types/erb.html.erb
136
+ - spec/dummy/app/views/view_types/haml.html.haml
137
+ - spec/dummy/config/application.rb
138
+ - spec/dummy/config/boot.rb
139
+ - spec/dummy/config/environment.rb
140
+ - spec/dummy/config/environments/development.rb
141
+ - spec/dummy/config/environments/test.rb
142
+ - spec/dummy/config/initializers/sections_rails.rb
143
+ - spec/dummy/config/routes.rb
144
+ - spec/dummy/config.ru
145
+ - spec/dummy/log/development.log
146
+ - spec/dummy/tmp/cache/assets/CB9/B60/sprockets%2Fe7b839a0806e5c20e5018197f56cd656
147
+ - spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
148
+ - spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
149
+ - spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
150
+ - spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
151
+ - spec/dummy/tmp/cache/assets/D76/4D0/sprockets%2F8a096b6dd59bfda3e461617a95524eaf
152
+ - spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
153
+ - spec/dummy/tmp/cache/assets/DE1/6A0/sprockets%2Fcae9aba95894da8a28fa8a5387dc565f
154
+ - spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
155
+ - spec/dummy/tmp/cache/assets/E1D/010/sprockets%2Fdffad412d86bfdfbb1f307d711da21d3
89
156
  - spec/sections_rails/section_spec.rb
90
157
  - spec/spec_helper.rb
91
158
  homepage: https://github.com/kevgo/sections_rails
@@ -114,5 +181,61 @@ specification_version: 3
114
181
  summary: A rails plugin that allows to define the HTML, CSS, and JS for individual
115
182
  sections of pages as one unit.
116
183
  test_files:
184
+ - spec/controllers/errors_controller_spec.rb
185
+ - spec/controllers/partials_controller_spec.rb
186
+ - spec/controllers/script_assets_controller_spec.rb
187
+ - spec/controllers/style_assets_controller_spec.rb
188
+ - spec/controllers/view_types_controller_spec.rb
189
+ - spec/dummy/app/assets/images/rails.png
190
+ - spec/dummy/app/assets/javascripts/application.js
191
+ - spec/dummy/app/assets/stylesheets/application.css
192
+ - spec/dummy/app/controllers/application_controller.rb
193
+ - spec/dummy/app/controllers/errors_controller.rb
194
+ - spec/dummy/app/controllers/partials_controller.rb
195
+ - spec/dummy/app/controllers/script_assets_controller.rb
196
+ - spec/dummy/app/controllers/style_assets_controller.rb
197
+ - spec/dummy/app/controllers/view_types_controller.rb
198
+ - spec/dummy/app/views/errors/missing_section.html.erb
199
+ - spec/dummy/app/views/layouts/application.html.erb
200
+ - spec/dummy/app/views/partials/custom_partial.html.erb
201
+ - spec/dummy/app/views/partials/disabled.html.erb
202
+ - spec/dummy/app/views/partials/erb_section.html.erb
203
+ - spec/dummy/app/views/partials/haml_section.html.erb
204
+ - spec/dummy/app/views/partials/no_options.html.erb
205
+ - spec/dummy/app/views/partials/production_mode.html.erb
206
+ - spec/dummy/app/views/script_assets/coffeescript.html.erb
207
+ - spec/dummy/app/views/script_assets/custom_script.html.erb
208
+ - spec/dummy/app/views/script_assets/javascript.html.erb
209
+ - spec/dummy/app/views/script_assets/no_script.html.erb
210
+ - spec/dummy/app/views/script_assets/production_mode.html.erb
211
+ - spec/dummy/app/views/style_assets/css.html.erb
212
+ - spec/dummy/app/views/style_assets/css_sass.html.erb
213
+ - spec/dummy/app/views/style_assets/css_scss.html.erb
214
+ - spec/dummy/app/views/style_assets/custom_style.html.erb
215
+ - spec/dummy/app/views/style_assets/no_style.html.erb
216
+ - spec/dummy/app/views/style_assets/production_mode.html.erb
217
+ - spec/dummy/app/views/style_assets/sass.html.erb
218
+ - spec/dummy/app/views/style_assets/scss.html.erb
219
+ - spec/dummy/app/views/view_types/erb.html.erb
220
+ - spec/dummy/app/views/view_types/haml.html.haml
221
+ - spec/dummy/config/application.rb
222
+ - spec/dummy/config/boot.rb
223
+ - spec/dummy/config/environment.rb
224
+ - spec/dummy/config/environments/development.rb
225
+ - spec/dummy/config/environments/test.rb
226
+ - spec/dummy/config/initializers/sections_rails.rb
227
+ - spec/dummy/config/routes.rb
228
+ - spec/dummy/config.ru
229
+ - spec/dummy/log/development.log
230
+ - spec/dummy/tmp/cache/assets/CB9/B60/sprockets%2Fe7b839a0806e5c20e5018197f56cd656
231
+ - spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
232
+ - spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
233
+ - spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
234
+ - spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
235
+ - spec/dummy/tmp/cache/assets/D76/4D0/sprockets%2F8a096b6dd59bfda3e461617a95524eaf
236
+ - spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
237
+ - spec/dummy/tmp/cache/assets/DE1/6A0/sprockets%2Fcae9aba95894da8a28fa8a5387dc565f
238
+ - spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
239
+ - spec/dummy/tmp/cache/assets/E1D/010/sprockets%2Fdffad412d86bfdfbb1f307d711da21d3
117
240
  - spec/sections_rails/section_spec.rb
118
241
  - spec/spec_helper.rb