mascot-rails 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/routes.rb +1 -1
- data/lib/mascot/action_controller_context.rb +1 -1
- data/lib/mascot/extensions/index_request_path.rb +22 -0
- data/lib/mascot/extensions/layouts.rb +27 -0
- data/lib/mascot/rails.rb +2 -0
- data/spec/dummy/log/production.log +56 -0
- data/spec/dummy/log/test.log +4692 -0
- data/spec/mascot/extensions/index_request_path_spec.rb +15 -0
- data/spec/mascot/extensions/layouts_spec.rb +14 -0
- data/spec/mascot/mascot_sitemap_controller_spec.rb +3 -3
- data/spec/mascot/routes_spec.rb +1 -1
- data/spec/pages/index.html.erb +1 -0
- data/spec/pages/super.duper/index.html +3 -0
- metadata +14 -4
@@ -0,0 +1,15 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Mascot::Extensions::IndexRequestPath do
|
4
|
+
subject { Mascot::Extensions::IndexRequestPath.new }
|
5
|
+
let(:resources) { Mascot::Sitemap.new(root: "spec/pages").resources.glob("**/index*") }
|
6
|
+
let(:resource) { resources.first }
|
7
|
+
|
8
|
+
context "#process_resources" do
|
9
|
+
before { subject.process_resources(resources) }
|
10
|
+
it "changes /index.html request_path to /" do
|
11
|
+
# require "pry" ; binding.pry
|
12
|
+
expect(resource.request_path).to eql("/")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Mascot::Extensions::Layouts do
|
4
|
+
subject { Mascot::Extensions::Layouts.new }
|
5
|
+
let(:resources) { Mascot::Sitemap.new(root: "spec/pages").resources }
|
6
|
+
let(:resource) { resources.first }
|
7
|
+
before do
|
8
|
+
subject.layout("blah-set-by-rspec"){ |r| r == resource }
|
9
|
+
subject.process_resources resources
|
10
|
+
end
|
11
|
+
it "sets resource.data['layout'] key" do
|
12
|
+
expect(resource.data['layout']).to eql("blah-set-by-rspec")
|
13
|
+
end
|
14
|
+
end
|
@@ -3,7 +3,7 @@ require "spec_helper"
|
|
3
3
|
describe Mascot::SitemapController, type: :controller do
|
4
4
|
context "existing templated page" do
|
5
5
|
render_views
|
6
|
-
before { get :show,
|
6
|
+
before { get :show, resource_path: "/time" }
|
7
7
|
let(:resource) { Mascot.configuration.sitemap.get("/time") }
|
8
8
|
it "is status 200" do
|
9
9
|
expect(response.status).to eql(200)
|
@@ -30,7 +30,7 @@ describe Mascot::SitemapController, type: :controller do
|
|
30
30
|
|
31
31
|
context "existing static page" do
|
32
32
|
render_views
|
33
|
-
before { get :show,
|
33
|
+
before { get :show, resource_path: "/hi" }
|
34
34
|
it "is status 200" do
|
35
35
|
expect(response.status).to eql(200)
|
36
36
|
end
|
@@ -48,7 +48,7 @@ describe Mascot::SitemapController, type: :controller do
|
|
48
48
|
context "non-existent page" do
|
49
49
|
it "is status 404" do
|
50
50
|
expect {
|
51
|
-
get :show,
|
51
|
+
get :show, resource_path: "/non-existent"
|
52
52
|
}.to raise_exception(ActionController::RoutingError)
|
53
53
|
end
|
54
54
|
end
|
data/spec/mascot/routes_spec.rb
CHANGED
@@ -10,7 +10,7 @@ describe "Mascot routes", type: :routing do
|
|
10
10
|
expect(page_path("hi")).to eql("/hi")
|
11
11
|
end
|
12
12
|
it "is routable" do
|
13
|
-
expect(get("/hi")).to route_to(controller: "mascot/sitemap", action: "show",
|
13
|
+
expect(get("/hi")).to route_to(controller: "mascot/sitemap", action: "show", resource_path: "hi")
|
14
14
|
end
|
15
15
|
end
|
16
16
|
context "routes disabled" do
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>Well I'm the index!</h1>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mascot-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brad Gessler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.1.
|
61
|
+
version: 0.1.9
|
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: 0.1.
|
68
|
+
version: 0.1.9
|
69
69
|
description:
|
70
70
|
email:
|
71
71
|
- bradgessler@gmail.com
|
@@ -81,6 +81,8 @@ files:
|
|
81
81
|
- lib/mascot-rails.rb
|
82
82
|
- lib/mascot/action_controller_context.rb
|
83
83
|
- lib/mascot/engine.rb
|
84
|
+
- lib/mascot/extensions/index_request_path.rb
|
85
|
+
- lib/mascot/extensions/layouts.rb
|
84
86
|
- lib/mascot/extensions/partials_remover.rb
|
85
87
|
- lib/mascot/extensions/rails_request_paths.rb
|
86
88
|
- lib/mascot/rails.rb
|
@@ -147,14 +149,18 @@ files:
|
|
147
149
|
- spec/dummy/public/favicon.ico
|
148
150
|
- spec/mascot-rails_spec.rb
|
149
151
|
- spec/mascot/action_controller_context_spec.rb
|
152
|
+
- spec/mascot/extensions/index_request_path_spec.rb
|
153
|
+
- spec/mascot/extensions/layouts_spec.rb
|
150
154
|
- spec/mascot/extensions/partials_remover_spec.rb
|
151
155
|
- spec/mascot/extensions/rails_request_paths_spec.rb
|
152
156
|
- spec/mascot/mascot_sitemap_controller_spec.rb
|
153
157
|
- spec/mascot/rails_configuration_spec.rb
|
154
158
|
- spec/mascot/route_constraint_spec.rb
|
155
159
|
- spec/mascot/routes_spec.rb
|
160
|
+
- spec/pages/index.html.erb
|
156
161
|
- spec/pages/nothing
|
157
162
|
- spec/pages/sin_frontmatter.html.haml
|
163
|
+
- spec/pages/super.duper/index.html
|
158
164
|
- spec/pages/test.html.haml
|
159
165
|
- spec/pages/text.txt
|
160
166
|
- spec/spec_helper.rb
|
@@ -241,6 +247,8 @@ test_files:
|
|
241
247
|
- spec/dummy/public/favicon.ico
|
242
248
|
- spec/dummy/Rakefile
|
243
249
|
- spec/mascot/action_controller_context_spec.rb
|
250
|
+
- spec/mascot/extensions/index_request_path_spec.rb
|
251
|
+
- spec/mascot/extensions/layouts_spec.rb
|
244
252
|
- spec/mascot/extensions/partials_remover_spec.rb
|
245
253
|
- spec/mascot/extensions/rails_request_paths_spec.rb
|
246
254
|
- spec/mascot/mascot_sitemap_controller_spec.rb
|
@@ -248,8 +256,10 @@ test_files:
|
|
248
256
|
- spec/mascot/route_constraint_spec.rb
|
249
257
|
- spec/mascot/routes_spec.rb
|
250
258
|
- spec/mascot-rails_spec.rb
|
259
|
+
- spec/pages/index.html.erb
|
251
260
|
- spec/pages/nothing
|
252
261
|
- spec/pages/sin_frontmatter.html.haml
|
262
|
+
- spec/pages/super.duper/index.html
|
253
263
|
- spec/pages/test.html.haml
|
254
264
|
- spec/pages/text.txt
|
255
265
|
- spec/spec_helper.rb
|