mascot-rails 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,10 +33,32 @@ describe Mascot::RouteConstraint do
33
33
  end
34
34
  end
35
35
 
36
+ describe Mascot::ActionControllerContext do
37
+ subject { Mascot::ActionControllerContext.new(controller: controller, sitemap: sitemap) }
38
+ let(:sitemap) { Mascot.configuration.sitemap }
39
+ let(:resource) { sitemap.resources("**.erb*").first }
40
+ context "#render" do
41
+ let(:controller) { instance_double("Controller", render: true, _layout: "application") }
42
+ it "calls render" do
43
+ expect(controller).to receive(:render).with(inline: resource.body,
44
+ type: "erb",
45
+ layout: "flipper",
46
+ locals: {
47
+ sitemap: sitemap,
48
+ current_page: resource,
49
+ cat: "in-a-hat"
50
+ },
51
+ content_type: resource.mime_type.to_s)
52
+ subject.render(resource.request_path, locals: {cat: "in-a-hat"}, layout: "flipper")
53
+ end
54
+ end
55
+ end
56
+
36
57
  describe Mascot::SitemapController, type: :controller do
37
58
  context "existing templated page" do
38
59
  render_views
39
60
  before { get :show, path: "/time" }
61
+ let(:resource) { Mascot.configuration.sitemap.find_by_request_path("/time") }
40
62
  it "is status 200" do
41
63
  expect(response.status).to eql(200)
42
64
  end
@@ -49,6 +71,15 @@ describe Mascot::SitemapController, type: :controller do
49
71
  it "responds with content type" do
50
72
  expect(response.content_type).to eql("text/html")
51
73
  end
74
+ context "@_mascot_locals assignment" do
75
+ subject { assigns(:_mascot_locals) }
76
+ it ":current_page" do
77
+ expect(subject[:current_page].file_path).to eql(resource.file_path)
78
+ end
79
+ it ":sitemap" do
80
+ expect(subject[:sitemap]).to eql(Mascot.configuration.sitemap)
81
+ end
82
+ end
52
83
  end
53
84
 
54
85
  context "existing static page" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mascot-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.1.4
61
+ version: 0.1.5
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.4
68
+ version: 0.1.5
69
69
  description:
70
70
  email:
71
71
  - bradgessler@gmail.com