sitepress-rails 0.1.27 → 0.1.28

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,41 +4,48 @@ require "sitepress-rails"
4
4
  describe "Sitepress.configuration" do
5
5
  subject { Sitepress.configuration }
6
6
  let(:app) { Dummy::Application.new }
7
- let(:cache_classes) { true }
7
+ let(:cache_classes) { false }
8
8
  before do
9
9
  app.config.eager_load = cache_classes # WTF?
10
- app.config.cache_classes = cache_classes # This is what I really want to test.
11
- app.initialize!
12
10
  end
13
11
  it "has site" do
12
+ app.initialize!
14
13
  expect(subject.site.root_path).to eql(app.root.join("app/content"))
15
14
  end
16
15
  it "has Rails.application as parent engine" do
16
+ app.initialize!
17
17
  expect(subject.parent_engine).to eql(app)
18
18
  end
19
19
  it "has Rails.application as parent engine" do
20
- expect(subject.cache_resources).to be true
20
+ app.initialize!
21
+ expect(subject.cache_resources).to be_nil
21
22
  end
22
23
  it "has routes enabled by default" do
24
+ app.initialize!
23
25
  expect(subject.routes).to be true
24
26
  end
25
27
  context "#cache_resources" do
28
+ before do
29
+ app.config.cache_classes = cache_classes # This is what I really want to test.
30
+ end
26
31
  context "Rails.configuration.cache_classes=true" do
27
32
  let(:cache_classes) { true }
28
33
  it "is true" do
34
+ app.initialize!
29
35
  expect(subject.cache_resources).to eql(true)
30
36
  end
31
37
  end
32
38
  context "Rails.configuration.cache_classes=false" do
33
39
  let(:cache_classes) { false }
34
40
  it "is false" do
41
+ app.initialize!
35
42
  expect(subject.cache_resources).to eql(false)
36
43
  end
37
44
  end
38
45
  end
39
46
  context "Sitepress::Middleware::RequestCache" do
40
47
  it "is in Rails middleware stack" do
41
- expect(app.config.middleware).to include(Sitepress::Middleware::RequestCache)
48
+ expect(Rails.configuration.middleware).to include(Sitepress::Middleware::RequestCache)
42
49
  end
43
50
  end
44
51
  context "Rails.configuration.paths" do
@@ -1,9 +1,18 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Sitepress::SiteController, type: :controller do
4
+ # Rails 5 introduces a new format of calling the `get` rspec helper method.
5
+ def get_resource(path)
6
+ if Gem::Version.new(Rails.version) >= Gem::Version.new("5.0.0")
7
+ get :show, params: { resource_path: path }
8
+ else
9
+ get :show, resource_path: path
10
+ end
11
+ end
12
+
4
13
  context "templated page" do
5
14
  render_views
6
- before { get :show, resource_path: "/time" }
15
+ before { get_resource "/time" }
7
16
  let(:resource) { Sitepress.site.get("/time") }
8
17
  it "is status 200" do
9
18
  expect(response.status).to eql(200)
@@ -30,7 +39,7 @@ describe Sitepress::SiteController, type: :controller do
30
39
 
31
40
  context "static page" do
32
41
  render_views
33
- before { get :show, resource_path: "/hi" }
42
+ before { get_resource "/hi" }
34
43
  it "is status 200" do
35
44
  expect(response.status).to eql(200)
36
45
  end
@@ -48,7 +57,7 @@ describe Sitepress::SiteController, type: :controller do
48
57
  context "non-existent page" do
49
58
  it "is status 404" do
50
59
  expect {
51
- get :show, resource_path: "/non-existent"
60
+ get_resource "/non-existent"
52
61
  }.to raise_exception(ActionController::RoutingError)
53
62
  end
54
63
  end
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: 0.1.27
4
+ version: 0.1.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-30 00:00:00.000000000 Z
11
+ date: 2017-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3
@@ -56,14 +56,14 @@ dependencies:
56
56
  name: rails
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '4.0'
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
68
  version: '4.0'
69
69
  - !ruby/object:Gem::Dependency
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 0.1.27
75
+ version: 0.1.28
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: 0.1.27
82
+ version: 0.1.28
83
83
  description:
84
84
  email:
85
85
  - bradgessler@gmail.com
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
196
  version: '0'
197
197
  requirements: []
198
198
  rubyforge_project:
199
- rubygems_version: 2.5.2
199
+ rubygems_version: 2.6.11
200
200
  signing_key:
201
201
  specification_version: 4
202
202
  summary: Sitepress rails integration.