sitepress-rails 2.0.0.beta4 → 2.0.0.beta9

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,31 +12,12 @@ describe "Sitepress.configuration" do
12
12
  app.initialize!
13
13
  expect(subject.parent_engine).to eql(app)
14
14
  end
15
- it "has Rails.application as parent engine" do
16
- app.initialize!
17
- expect(subject.cache_resources).to be_nil
18
- end
19
15
  it "has routes enabled by default" do
20
16
  app.initialize!
21
17
  expect(subject.routes).to be true
22
18
  end
23
- context "#cache_resources" do
24
- before do
25
- app.config.cache_classes = cache_classes # This is what I really want to test.
26
- end
27
- context "Rails.configuration.cache_classes=true" do
28
- let(:cache_classes) { true }
29
- it "is true" do
30
- app.initialize!
31
- expect(subject.cache_resources).to eql(true)
32
- end
33
- end
34
- context "Rails.configuration.cache_classes=false" do
35
- let(:cache_classes) { false }
36
- it "is false" do
37
- app.initialize!
38
- expect(subject.cache_resources).to eql(false)
39
- end
40
- end
19
+ it "sets Sitepress::Path.template_extensions" do
20
+ app.initialize!
21
+ expect(Sitepress::Path.handler_extensions).to eql([:raw, :erb, :html, :builder, :ruby])
41
22
  end
42
23
  end
@@ -4,16 +4,16 @@ require "fileutils"
4
4
 
5
5
  describe Sitepress::Compiler do
6
6
  let(:site) { Sitepress.site }
7
- let(:target) { Pathname.new(Dir::tmpdir).join("build") }
7
+ let(:build_path) { Pathname.new(Dir::tmpdir).join("build") }
8
8
  # Write compiler output to /dev/null so our test output remains clean.
9
9
  let(:stdout) { File.open(File::NULL, "w") }
10
- subject { Sitepress::Compiler.new(site: site, stdout: stdout) }
10
+ subject { Sitepress::Compiler.new(site: site, stdout: stdout, root_path: build_path) }
11
11
  describe "#compile" do
12
- before { FileUtils.mkdir_p(target) }
13
- after { FileUtils.rm_rf(target) }
14
- it "writes files to target" do
15
- subject.compile(target_path: target)
16
- expect(Dir.glob(target.join("**")).size).to eql(2) # 2 items in the site... mkay?
12
+ before { FileUtils.mkdir_p(build_path) }
13
+ after { FileUtils.rm_rf(build_path) }
14
+ it "writes files to build_path" do
15
+ subject.compile
16
+ expect(Dir.glob(build_path.join("**")).size).to eql(3) # 2 items in the site... mkay?
17
17
  end
18
18
  end
19
19
  end
@@ -3,6 +3,7 @@ require "spec_helper"
3
3
  describe Sitepress::SiteController, type: :controller do
4
4
  # Rails 5 introduces a new format of calling the `get` rspec helper method.
5
5
  def get_resource(path)
6
+ request.env["PATH_INFO"] = path
6
7
  if Gem::Version.new(Rails.version) >= Gem::Version.new("5.0.0")
7
8
  get :show, params: { resource_path: path }
8
9
  else
@@ -48,8 +49,8 @@ describe Sitepress::SiteController, type: :controller do
48
49
  it "renders body" do
49
50
  expect(response.body).to include("<h1>Hi!</h1>")
50
51
  end
51
- it "does not render layout" do
52
- expect(response.body).to_not include("<title>Dummy</title>")
52
+ it "renders default 'layouts/application' layout" do
53
+ expect(response.body).to include("<title>Dummy</title>")
53
54
  end
54
55
  it "responds with content type" do
55
56
  expect(response.content_type).to include("text/html")
@@ -79,27 +80,8 @@ describe Sitepress::SiteController, type: :controller do
79
80
  end
80
81
  end
81
82
 
82
- context "render cache" do
83
- context "cache_resources=true" do
84
- before { site.cache_resources = true }
85
- it "enables cache" do
86
- expect(site.cache_resources).to be true
87
- expect(site).to receive(:cache_resources=).with(true)
88
- expect(site).to receive(:cache_resources=).with(true)
89
- get_resource "/time"
90
- expect(site.cache_resources).to be true
91
- end
92
- end
93
- context "cache_resources=false" do
94
- before { site.cache_resources = false }
95
- it "enables cache" do
96
- expect(site.cache_resources).to be false
97
- expect(site).to receive(:cache_resources=).with(true)
98
- expect(site).to receive(:cache_resources=).with(false)
99
- get_resource "/time"
100
- expect(site.cache_resources).to be false
101
- end
102
- end
103
-
83
+ it "builds site once" do
84
+ allow(site).to receive(:root).once.and_return(site.root)
85
+ get_resource "/all_pages"
104
86
  end
105
87
  end
data/spec/spec_helper.rb CHANGED
@@ -3,7 +3,8 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
3
3
  ENV['RAILS_ENV'] ||= 'test'
4
4
 
5
5
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
6
- require 'rspec/rails'
6
+ require "rspec/rails"
7
+ require "pry"
7
8
 
8
9
  Rails.backtrace_cleaner.remove_silencers!
9
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sitepress-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta4
4
+ version: 2.0.0.beta9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-24 00:00:00.000000000 Z
11
+ date: 2021-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-rails
@@ -58,42 +58,42 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 2.0.0.beta4
61
+ version: 2.0.0.beta9
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 2.0.0.beta4
68
+ version: 2.0.0.beta9
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: railties
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '5.0'
75
+ version: '6.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '5.0'
82
+ version: '6.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: actionpack
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '5.0'
89
+ version: '6.0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '5.0'
96
+ version: '6.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: sprockets-rails
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -129,6 +129,7 @@ files:
129
129
  - lib/sitepress/rails_configuration.rb
130
130
  - lib/sitepress/renderers/controller.rb
131
131
  - lib/sitepress/renderers/server.rb
132
+ - lib/sitepress/rendition.rb
132
133
  - lib/sitepress/route_constraint.rb
133
134
  - lib/tasks/sitepress_tasks.rake
134
135
  - rails/app/controllers/concerns/sitepress/site_pages.rb
@@ -143,6 +144,7 @@ files:
143
144
  - spec/dummy/app/content/helpers/sample_helper.rb
144
145
  - spec/dummy/app/content/layouts/sitepress_test_layout.html.erb
145
146
  - spec/dummy/app/content/pages/_stupid.html.erb
147
+ - spec/dummy/app/content/pages/all_pages.html.erb
146
148
  - spec/dummy/app/content/pages/hi.html
147
149
  - spec/dummy/app/content/pages/partials/_really_stupid.html.erb
148
150
  - spec/dummy/app/content/pages/time.html.erb
@@ -184,6 +186,8 @@ files:
184
186
  - spec/dummy/config/routes.rb
185
187
  - spec/dummy/config/secrets.yml
186
188
  - spec/dummy/config/spring.rb
189
+ - spec/dummy/db/test.sqlite3
190
+ - spec/dummy/log/production.log
187
191
  - spec/dummy/log/test.log
188
192
  - spec/dummy/public/404.html
189
193
  - spec/dummy/public/422.html
@@ -205,7 +209,8 @@ files:
205
209
  - spec/sites/sample/pages/text.txt
206
210
  - spec/spec_helper.rb
207
211
  homepage: https://github.com/sitepress/sitepress
208
- licenses: []
212
+ licenses:
213
+ - MIT
209
214
  metadata: {}
210
215
  post_install_message:
211
216
  rdoc_options: []
@@ -222,77 +227,80 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
227
  - !ruby/object:Gem::Version
223
228
  version: 1.3.1
224
229
  requirements: []
225
- rubygems_version: 3.2.3
230
+ rubygems_version: 3.1.4
226
231
  signing_key:
227
232
  specification_version: 4
228
233
  summary: Sitepress rails integration.
229
234
  test_files:
230
- - spec/dummy/Rakefile
231
- - spec/dummy/app/assets/config/manifest.js
232
- - spec/dummy/app/assets/javascripts/application.js
233
- - spec/dummy/app/assets/javascripts/cable.js
234
- - spec/dummy/app/assets/stylesheets/application.css
235
- - spec/dummy/app/content/helpers/sample_helper.rb
235
+ - spec/spec_helper.rb
236
+ - spec/sitepress-rails_spec.rb
237
+ - spec/dummy/app/mailers/application_mailer.rb
236
238
  - spec/dummy/app/content/layouts/sitepress_test_layout.html.erb
239
+ - spec/dummy/app/content/pages/time.html.erb
237
240
  - spec/dummy/app/content/pages/_stupid.html.erb
238
241
  - spec/dummy/app/content/pages/hi.html
239
242
  - spec/dummy/app/content/pages/partials/_really_stupid.html.erb
240
- - spec/dummy/app/content/pages/time.html.erb
243
+ - spec/dummy/app/content/pages/all_pages.html.erb
244
+ - spec/dummy/app/content/helpers/sample_helper.rb
245
+ - spec/dummy/app/jobs/application_job.rb
241
246
  - spec/dummy/app/controllers/application_controller.rb
242
247
  - spec/dummy/app/controllers/baseline_controller.rb
243
- - spec/dummy/app/helpers/application_helper.rb
244
- - spec/dummy/app/jobs/application_job.rb
245
- - spec/dummy/app/mailers/application_mailer.rb
246
248
  - spec/dummy/app/views/baseline/show.html.erb
247
249
  - spec/dummy/app/views/layouts/application.html.erb
248
250
  - spec/dummy/app/views/layouts/mailer.html.erb
249
251
  - spec/dummy/app/views/layouts/mailer.text.erb
250
- - spec/dummy/bin/bundle
251
- - spec/dummy/bin/rails
252
+ - spec/dummy/app/assets/config/manifest.js
253
+ - spec/dummy/app/assets/javascripts/cable.js
254
+ - spec/dummy/app/assets/javascripts/application.js
255
+ - spec/dummy/app/assets/stylesheets/application.css
256
+ - spec/dummy/app/helpers/application_helper.rb
257
+ - spec/dummy/bin/update
252
258
  - spec/dummy/bin/rake
253
259
  - spec/dummy/bin/setup
254
- - spec/dummy/bin/update
255
- - spec/dummy/config/application.rb
256
- - spec/dummy/config/boot.rb
260
+ - spec/dummy/bin/bundle
261
+ - spec/dummy/bin/rails
262
+ - spec/dummy/config/secrets.yml
263
+ - spec/dummy/config/routes.rb
264
+ - spec/dummy/config/locales/en.yml
257
265
  - spec/dummy/config/cable.yml
258
- - spec/dummy/config/database.yml
259
- - spec/dummy/config/environment.rb
260
- - spec/dummy/config/environments/development.rb
261
266
  - spec/dummy/config/environments/production.rb
267
+ - spec/dummy/config/environments/development.rb
262
268
  - spec/dummy/config/environments/test.rb
269
+ - spec/dummy/config/spring.rb
270
+ - spec/dummy/config/environment.rb
271
+ - spec/dummy/config/application.rb
272
+ - spec/dummy/config/puma.rb
273
+ - spec/dummy/config/database.yml
274
+ - spec/dummy/config/boot.rb
263
275
  - spec/dummy/config/initializers/application_controller_renderer.rb
264
- - spec/dummy/config/initializers/assets.rb
265
276
  - spec/dummy/config/initializers/backtrace_silencers.rb
266
- - spec/dummy/config/initializers/cookies_serializer.rb
267
- - spec/dummy/config/initializers/filter_parameter_logging.rb
268
- - spec/dummy/config/initializers/inflections.rb
269
- - spec/dummy/config/initializers/mime_types.rb
270
277
  - spec/dummy/config/initializers/null_logger.rb
278
+ - spec/dummy/config/initializers/mime_types.rb
279
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
271
280
  - spec/dummy/config/initializers/session_store.rb
272
281
  - spec/dummy/config/initializers/wrap_parameters.rb
273
- - spec/dummy/config/locales/en.yml
274
- - spec/dummy/config/puma.rb
275
- - spec/dummy/config/routes.rb
276
- - spec/dummy/config/secrets.yml
277
- - spec/dummy/config/spring.rb
282
+ - spec/dummy/config/initializers/assets.rb
283
+ - spec/dummy/config/initializers/cookies_serializer.rb
284
+ - spec/dummy/config/initializers/inflections.rb
278
285
  - spec/dummy/config.ru
279
- - spec/dummy/log/test.log
280
- - spec/dummy/public/404.html
286
+ - spec/dummy/Rakefile
287
+ - spec/dummy/public/favicon.ico
281
288
  - spec/dummy/public/422.html
289
+ - spec/dummy/public/apple-touch-icon.png
282
290
  - spec/dummy/public/500.html
291
+ - spec/dummy/public/404.html
283
292
  - spec/dummy/public/apple-touch-icon-precomposed.png
284
- - spec/dummy/public/apple-touch-icon.png
285
- - spec/dummy/public/favicon.ico
286
- - spec/sitepress/compiler_spec.rb
287
- - spec/sitepress/rails_configuration_spec.rb
288
- - spec/sitepress/route_constraint_spec.rb
289
- - spec/sitepress/routes_spec.rb
290
- - spec/sitepress/sitepress_site_controller_spec.rb
291
- - spec/sitepress-rails_spec.rb
293
+ - spec/dummy/db/test.sqlite3
294
+ - spec/dummy/log/test.log
295
+ - spec/dummy/log/production.log
292
296
  - spec/sites/sample/pages/index.html.erb
293
- - spec/sites/sample/pages/nothing
297
+ - spec/sites/sample/pages/test.html.haml
294
298
  - spec/sites/sample/pages/sin_frontmatter.html.haml
295
299
  - spec/sites/sample/pages/super.duper/index.html
296
- - spec/sites/sample/pages/test.html.haml
300
+ - spec/sites/sample/pages/nothing
297
301
  - spec/sites/sample/pages/text.txt
298
- - spec/spec_helper.rb
302
+ - spec/sitepress/sitepress_site_controller_spec.rb
303
+ - spec/sitepress/rails_configuration_spec.rb
304
+ - spec/sitepress/routes_spec.rb
305
+ - spec/sitepress/route_constraint_spec.rb
306
+ - spec/sitepress/compiler_spec.rb