sitepress-rails 2.0.0.beta6 → 2.0.0.beta10

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
@@ -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.beta6
4
+ version: 2.0.0.beta10
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-03-05 00:00:00.000000000 Z
11
+ date: 2021-07-23 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.beta6
61
+ version: 2.0.0.beta10
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.beta6
68
+ version: 2.0.0.beta10
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: []
@@ -235,6 +240,7 @@ test_files:
235
240
  - spec/dummy/app/content/helpers/sample_helper.rb
236
241
  - spec/dummy/app/content/layouts/sitepress_test_layout.html.erb
237
242
  - spec/dummy/app/content/pages/_stupid.html.erb
243
+ - spec/dummy/app/content/pages/all_pages.html.erb
238
244
  - spec/dummy/app/content/pages/hi.html
239
245
  - spec/dummy/app/content/pages/partials/_really_stupid.html.erb
240
246
  - spec/dummy/app/content/pages/time.html.erb
@@ -276,6 +282,8 @@ test_files:
276
282
  - spec/dummy/config/secrets.yml
277
283
  - spec/dummy/config/spring.rb
278
284
  - spec/dummy/config.ru
285
+ - spec/dummy/db/test.sqlite3
286
+ - spec/dummy/log/production.log
279
287
  - spec/dummy/log/test.log
280
288
  - spec/dummy/public/404.html
281
289
  - spec/dummy/public/422.html