hyperloop 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -0
  3. data/Gemfile +1 -1
  4. data/README.md +89 -11
  5. data/Rakefile +5 -0
  6. data/bin/hyperloop +7 -0
  7. data/hyperloop.gemspec +12 -3
  8. data/lib/hyperloop/application.rb +56 -16
  9. data/lib/hyperloop/cli.rb +11 -0
  10. data/lib/hyperloop/generators/site/Gemfile +3 -0
  11. data/lib/hyperloop/generators/site/_partial.html.erb +1 -0
  12. data/lib/hyperloop/generators/site/about.html.erb +3 -0
  13. data/lib/hyperloop/generators/site/app.css +2 -0
  14. data/lib/hyperloop/generators/site/app.js +2 -0
  15. data/lib/hyperloop/generators/site/application.html.erb +23 -0
  16. data/lib/hyperloop/generators/site/bootstrap.css +6805 -0
  17. data/lib/hyperloop/generators/site/config.ru +4 -0
  18. data/lib/hyperloop/generators/site/current-time.coffee +3 -0
  19. data/lib/hyperloop/generators/site/index.html.erb +11 -0
  20. data/lib/hyperloop/generators/site/jquery.js +8829 -0
  21. data/lib/hyperloop/generators/site/main.scss +7 -0
  22. data/lib/hyperloop/generators/site/socool.jpg +0 -0
  23. data/lib/hyperloop/generators/site.rb +47 -0
  24. data/lib/hyperloop/response.rb +2 -2
  25. data/lib/hyperloop/version.rb +1 -1
  26. data/lib/hyperloop/view/registry.rb +90 -0
  27. data/lib/hyperloop/view/scope.rb +23 -0
  28. data/lib/hyperloop/view.rb +73 -0
  29. data/lib/hyperloop.rb +3 -1
  30. data/spec/application_spec.rb +155 -19
  31. data/spec/fixtures/assets/app/assets/images/my-gif.gif +0 -0
  32. data/spec/fixtures/assets/app/assets/images/my-jpg.jpg +0 -0
  33. data/spec/fixtures/assets/app/assets/images/my-png.png +0 -0
  34. data/spec/fixtures/assets/app/assets/javascripts/app.js +1 -0
  35. data/spec/fixtures/assets/app/assets/javascripts/my-scripts.coffee +1 -0
  36. data/spec/fixtures/assets/app/assets/shouldfail/shouldfail.css +3 -0
  37. data/spec/fixtures/assets/app/assets/stylesheets/app.css +1 -0
  38. data/spec/fixtures/assets/app/assets/stylesheets/my-styles.scss +3 -0
  39. data/spec/fixtures/assets/app/views/index.html.erb +7 -0
  40. data/spec/fixtures/assets/app/views/layouts/application.html.erb +15 -0
  41. data/spec/fixtures/assets/vendor/assets/javascripts/vendored.js +1 -0
  42. data/spec/fixtures/assets/vendor/assets/stylesheets/vendored.css +3 -0
  43. data/spec/fixtures/erb/app/views/about.html.erb +10 -0
  44. data/spec/fixtures/erb/app/views/index.html.erb +10 -0
  45. data/spec/fixtures/layouts/app/views/index.html.erb +3 -0
  46. data/spec/fixtures/layouts/app/views/layouts/application.html.erb +12 -0
  47. data/spec/fixtures/layouts/app/views/subdir/index.html.erb +3 -0
  48. data/spec/fixtures/partials/app/views/index.html.erb +3 -0
  49. data/spec/fixtures/partials/app/views/layouts/application.html.erb +12 -0
  50. data/spec/fixtures/partials/app/views/subdir/_partial.html.erb +1 -0
  51. data/spec/fixtures/partials/app/views/subdir/index.html.erb +3 -0
  52. data/spec/fixtures/partials/app/views/subdir/nonroot.html.erb +3 -0
  53. data/spec/response_spec.rb +3 -3
  54. data/spec/spec_helper.rb +34 -0
  55. data/spec/view/registry_spec.rb +56 -0
  56. data/spec/view/scope_spec.rb +21 -0
  57. data/spec/view_spec.rb +93 -0
  58. metadata +202 -3
@@ -0,0 +1,7 @@
1
+ nav {
2
+ background-color: #ddd;
3
+
4
+ li {
5
+ background-color: #bbb;
6
+ }
7
+ }
@@ -0,0 +1,47 @@
1
+ require "thor/group"
2
+ require "hyperloop/version"
3
+
4
+ module Hyperloop
5
+ module Generators
6
+ class Site < Thor::Group
7
+ include Thor::Actions
8
+
9
+ argument :name, :type => :string
10
+
11
+ def self.source_root
12
+ File.join(File.dirname(__FILE__), "site")
13
+ end
14
+
15
+ def create_directories
16
+ empty_directory(name)
17
+ empty_directory(File.join(name, "app"))
18
+ empty_directory(File.join(name, "app", "assets"))
19
+ empty_directory(File.join(name, "app", "assets", "images"))
20
+ empty_directory(File.join(name, "app", "assets", "javascripts"))
21
+ empty_directory(File.join(name, "app", "assets", "stylesheets"))
22
+ empty_directory(File.join(name, "app", "views"))
23
+ empty_directory(File.join(name, "app", "views", "layouts"))
24
+ empty_directory(File.join(name, "vendor"))
25
+ empty_directory(File.join(name, "vendor", "assets"))
26
+ empty_directory(File.join(name, "vendor", "assets", "javascripts"))
27
+ empty_directory(File.join(name, "vendor", "assets", "stylesheets"))
28
+ end
29
+
30
+ def copy_files
31
+ template("config.ru", File.join(name, "config.ru"))
32
+ template("Gemfile", File.join(name, "Gemfile"))
33
+ copy_file("socool.jpg", File.join(name, "app", "assets", "images", "socool.jpg"))
34
+ template("app.js", File.join(name, "app", "assets", "javascripts", "app.js"))
35
+ template("current-time.coffee", File.join(name, "app", "assets", "javascripts", "current-time.coffee"))
36
+ template("app.css", File.join(name, "app", "assets", "stylesheets", "app.css"))
37
+ template("main.scss", File.join(name, "app", "assets", "stylesheets", "main.scss"))
38
+ template("application.html.erb", File.join(name, "app", "views", "layouts", "application.html.erb"))
39
+ template("index.html.erb", File.join(name, "app", "views", "index.html.erb"))
40
+ template("about.html.erb", File.join(name, "app", "views", "about.html.erb"))
41
+ template("_partial.html.erb", File.join(name, "app", "views", "_partial.html.erb"))
42
+ template("jquery.js", File.join(name, "vendor", "assets", "javascripts", "jquery.js"))
43
+ template("bootstrap.css", File.join(name, "vendor", "assets", "stylesheets", "bootstrap.css"))
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,10 +1,10 @@
1
- require 'rack'
1
+ require "rack"
2
2
 
3
3
  module Hyperloop
4
4
  class Response < Rack::Response
5
5
  def initialize(*)
6
6
  super
7
- headers['Content-Type'] ||= 'text/html'
7
+ headers["Content-Type"] ||= "text/html"
8
8
  end
9
9
  end
10
10
  end
@@ -1,3 +1,3 @@
1
1
  module Hyperloop
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -0,0 +1,90 @@
1
+ module Hyperloop
2
+ class View
3
+ class Registry
4
+ def initialize(root)
5
+ views_root = File.join([root, "app/views"].compact)
6
+ layout_path = views_root + "/layouts/application.html.erb"
7
+
8
+ # Get all the view paths. These look like:
9
+ #
10
+ # some/path/app/views/whatever.html.erb
11
+ # some/path/app/views/subdir/whatever.html.erb
12
+ # some/path/app/views/subdir/_partial.html.erb
13
+ view_paths = Dir.glob(views_root + "/**/*").reject {|fn| File.directory?(fn)}
14
+ view_paths -= [layout_path]
15
+
16
+ @template_views = {}
17
+ @partial_views = {}
18
+
19
+ view_paths.each do |path|
20
+ view = View.new(self, path, layout_path)
21
+
22
+ # The path under app/views. This will be something like:
23
+ #
24
+ # /whatever.html.erb
25
+ # /subdir/whatever.html.erb
26
+ # /subdir/_partial.html.erb
27
+ relative_path = path.sub(views_root, "")
28
+
29
+ # The path under app/views without a file extension (and without the
30
+ # starting _ for partials). This will be something like:
31
+ #
32
+ # /whatever
33
+ # /subdir/whatever
34
+ # /subdir/partial
35
+ request_dir = File.dirname(relative_path)
36
+ request_path = File.join(request_dir, view.name)
37
+
38
+ if view.partial?
39
+ # Chop off the leading forward slash for partials.
40
+ @partial_views[request_path.sub(/^\//, "")] = view
41
+ else
42
+ @template_views[request_path] = view
43
+ @template_views[request_dir] = view if view.name == "index"
44
+ end
45
+ end
46
+ end
47
+
48
+ # Public: Get the template view for the specified path.
49
+ #
50
+ # path - Relative path for the view. Should start under the app/views
51
+ # directory and not include file extensions. Should start with a forward
52
+ # slash.
53
+ #
54
+ # Example:
55
+ #
56
+ # Assuming there's a file at path/to/yoursite/app/views/subdir/whatever.html.erb
57
+ #
58
+ # bad: registry.find_template_view("/app/views/subdir/whatever.html.erb")
59
+ # bad: registry.find_template_view("/subdir/whatever.html.erb")
60
+ # bad: registry.find_template_view("subdir/whatever")
61
+ # good: registry.find_template_view("/subdir/whatever")
62
+ #
63
+ # Returns a Hyperloop::View or nil if no view was found.
64
+ def find_template_view(path)
65
+ @template_views[path]
66
+ end
67
+
68
+ # Public: Get the partial view for the specified path.
69
+ #
70
+ # path - Relative path for the view. Should start under the app/views
71
+ # directory and not include file extensions, leading underscores, or
72
+ # leading forward slashes.
73
+ #
74
+ # Example:
75
+ #
76
+ # Assuming there's a file at path/to/yoursite/app/views/subdir/_partial.html.erb
77
+ #
78
+ # bad: registry.find_partial_view("app/views/subdir/_partial.html.erb")
79
+ # bad: registry.find_partial_view("subdir/_partial.html.erb")
80
+ # bad: registry.find_partial_view("subdir/_partial")
81
+ # bad: registry.find_partial_view("/subdir/partial")
82
+ # good: registry.find_partial_view("subdir/partial")
83
+ #
84
+ # Returns a Hyperloop::View or nil if no view was found.
85
+ def find_partial_view(path)
86
+ @partial_views[path]
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,23 @@
1
+ require "tilt"
2
+
3
+ module Hyperloop
4
+ class View
5
+ class Scope
6
+ attr_reader :request
7
+
8
+ def initialize(request, view_registry)
9
+ @request = request
10
+ @view_registry = view_registry
11
+ end
12
+
13
+ # Public: Render the specified partial.
14
+ #
15
+ # path - Path to look for the partial at.
16
+ #
17
+ # Returns a string.
18
+ def render(path)
19
+ @view_registry.find_partial_view(path).render(request)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,73 @@
1
+ require "erb"
2
+ require "tilt"
3
+
4
+ module Hyperloop
5
+ class View
6
+ def initialize(view_registry, full_path, layout_path=nil)
7
+ @view_registry = view_registry
8
+ @full_path = full_path
9
+ @data = File.read(@full_path)
10
+
11
+ # Only load layout data if all of these things are true:
12
+ #
13
+ # 1. We're not in a partial
14
+ # 2. A layout path was provided
15
+ # 3. There's a file at the provided layout path
16
+ if !partial? && layout_path && File.file?(layout_path)
17
+ @layout_data = File.read(layout_path)
18
+ end
19
+ end
20
+
21
+ # Public: The format of the view. Derived from the view's extension.
22
+ #
23
+ # Returns a string.
24
+ def format
25
+ @format ||= File.extname(@full_path)[1..-1].intern
26
+ end
27
+
28
+ # Public: The name of the view. Derived from the view's filename without
29
+ # any extensions or leading underscores. Not guaranteed to be unique amongst
30
+ # other views in an app.
31
+ #
32
+ # Returns a string.
33
+ def name
34
+ @name ||= filename.split(".").first.sub(/^_/, "")
35
+ end
36
+
37
+ # Public: Is this view a partial?
38
+ #
39
+ # Returns a boolean.
40
+ def partial?
41
+ @partial ||= filename.start_with?("_")
42
+ end
43
+
44
+ # Public: Render the view.
45
+ #
46
+ # request - Rack request object that the view is being rendered in response
47
+ # to.
48
+ #
49
+ # Returns a string.
50
+ def render(request)
51
+ case format
52
+ when :html
53
+ @data
54
+ when :erb
55
+ scope = Scope.new(request, @view_registry)
56
+ view_html = Tilt["erb"].new { @data }.render(scope)
57
+
58
+ if @layout_data
59
+ layout_template = Tilt["erb"].new { @layout_data }
60
+ layout_template.render(scope) { view_html }
61
+ else
62
+ view_html
63
+ end
64
+ end
65
+ end
66
+
67
+ private
68
+
69
+ def filename
70
+ @filename ||= File.basename(@full_path)
71
+ end
72
+ end
73
+ end
data/lib/hyperloop.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  require "hyperloop/application"
2
2
  require "hyperloop/response"
3
3
  require "hyperloop/version"
4
+ require "hyperloop/view"
5
+ require "hyperloop/view/registry"
6
+ require "hyperloop/view/scope"
4
7
 
5
8
  module Hyperloop
6
- # Your code goes here...
7
9
  end
@@ -1,51 +1,187 @@
1
- require 'hyperloop'
1
+ require File.expand_path("../spec_helper", __FILE__)
2
2
 
3
3
  describe Hyperloop::Application do
4
- describe 'with a flat views directory' do
4
+ describe "with a flat views directory" do
5
5
  before :each do
6
- @app = Hyperloop::Application.new('spec/fixtures/simple/')
6
+ @app = Hyperloop::Application.new("spec/fixtures/simple/")
7
7
  @request = Rack::MockRequest.new(@app)
8
8
  end
9
9
 
10
- it 'responds successfully to a request for root' do
11
- response = @request.get('/')
10
+ it "responds successfully to a request for root" do
11
+ response = @request.get("/")
12
12
 
13
13
  expect(response).to be_ok
14
- expect(response.body).to match(/<h1>Simple/)
14
+ expect(response.content_type).to eql("text/html")
15
+ expect(text_in(response.body, "h1")).to eql("Simple")
15
16
  end
16
17
 
17
- it 'responds successfully to a request for a different page' do
18
- response = @request.get('/about')
18
+ it "responds successfully to a request for a different page" do
19
+ response = @request.get("/about")
19
20
 
20
21
  expect(response).to be_ok
21
- expect(response.body).to match(/<h1>About/)
22
+ expect(text_in(response.body, "h1")).to eql("About")
22
23
  end
23
24
 
24
- it '404s on a request for a nonexistent page' do
25
- response = @request.get('/nonexistent')
25
+ it "responds successfully to a request with a trailing slash" do
26
+ response = @request.get("/about/")
27
+
28
+ expect(response).to be_ok
29
+ expect(text_in(response.body, "h1")).to eql("About")
30
+ end
31
+
32
+ it "404s on a request for a nonexistent page" do
33
+ response = @request.get("/nonexistent")
26
34
 
27
35
  expect(response).to be_not_found
28
36
  end
29
37
  end
30
38
 
31
- describe 'with subdirectories' do
39
+ describe "with subdirectories" do
40
+ before :each do
41
+ @app = Hyperloop::Application.new("spec/fixtures/subdirectories/")
42
+ @request = Rack::MockRequest.new(@app)
43
+ end
44
+
45
+ it "responds successfully to a request for the subdirectory root" do
46
+ response = @request.get("/subdir1")
47
+
48
+ expect(response).to be_ok
49
+ expect(text_in(response.body, "h1")).to eql("Subdirectory Index")
50
+ end
51
+
52
+ it "responds successfully to a request for a different page in the subdirectory" do
53
+ response = @request.get("/subdir1/kanye")
54
+
55
+ expect(response).to be_ok
56
+ expect(text_in(response.body, "h1")).to eql("Hurry up with my damn croissant")
57
+ end
58
+ end
59
+
60
+ describe "with ERB" do
61
+ before :each do
62
+ @app = Hyperloop::Application.new("spec/fixtures/erb/")
63
+ @request = Rack::MockRequest.new(@app)
64
+ end
65
+
66
+ it "renders embedded Ruby in the root page" do
67
+ response = @request.get("/")
68
+
69
+ expect(response).to be_ok
70
+ expect(text_in(response.body, "h1")).to eql("WE ARE USING ERB")
71
+ end
72
+ end
73
+
74
+ describe "with a layout" do
75
+ before :each do
76
+ @app = Hyperloop::Application.new("spec/fixtures/layouts/")
77
+ @request = Rack::MockRequest.new(@app)
78
+ end
79
+
80
+ it "renders the root view within the layout" do
81
+ response = @request.get("/")
82
+
83
+ expect(response).to be_ok
84
+ expect(text_in(response.body, "h1")).to eql("Layout Header")
85
+ expect(text_in(response.body, "h2")).to eql("This is the root page!")
86
+ end
87
+
88
+ it "renders subdirectory views within the layout" do
89
+ response = @request.get("/subdir")
90
+
91
+ expect(response).to be_ok
92
+ expect(text_in(response.body, "h1")).to eql("Layout Header")
93
+ expect(text_in(response.body, "h2")).to eql("This is a page in a subdirectory!")
94
+ end
95
+ end
96
+
97
+ describe "with assets" do
32
98
  before :each do
33
- @app = Hyperloop::Application.new('spec/fixtures/subdirectories/')
99
+ @app = Hyperloop::Application.new("spec/fixtures/assets/")
34
100
  @request = Rack::MockRequest.new(@app)
35
101
  end
36
102
 
37
- it 'responds successfully to a request for the subdirectory root' do
38
- response = @request.get('/subdir1')
103
+ it "responds successfully to a request for root" do
104
+ response = @request.get("/")
105
+
106
+ expect(response).to be_ok
107
+ expect(text_in(response.body, "h1")).to eql("This app has so many assets")
108
+ end
109
+
110
+ it "responds successfully to a request for the css app bundle" do
111
+ response = @request.get("/assets/stylesheets/app.css")
112
+
113
+ expect(response).to be_ok
114
+ expect(response.content_type).to eql("text/css")
115
+ expect(response.body).to match(/display: ?block/)
116
+ end
117
+
118
+ it "responds successfully to a request for the javascript app bundle" do
119
+ response = @request.get("/assets/javascripts/app.js")
120
+
121
+ expect(response).to be_ok
122
+ expect(response.content_type).to eql("application/javascript")
123
+ expect(response.body).to match(/alert\("such javascript wow"\)/)
124
+ end
125
+
126
+ it "responds successfully to a request for a vendored css file" do
127
+ response = @request.get("/assets/stylesheets/vendored.css")
128
+
129
+ expect(response).to be_ok
130
+ expect(response.content_type).to eql("text/css")
131
+ expect(response.body).to match(/margin: ?0/)
132
+ end
133
+
134
+ it "responds successfully to a request for a vendored javascript bundle" do
135
+ response = @request.get("/assets/javascripts/vendored.js")
136
+
137
+ expect(response).to be_ok
138
+ expect(response.content_type).to eql("application/javascript")
139
+ expect(response.body).to match(/alert\("i am vendored"\)/)
140
+ end
141
+
142
+ it "responds successfully to a request for a gif" do
143
+ response = @request.get("/assets/images/my-gif.gif")
144
+
145
+ expect(response).to be_ok
146
+ expect(response.content_type).to eql("image/gif")
147
+ expect(Digest::SHA1.hexdigest(response.body)).to eql("bcbc6e6fc1eb77b2ca676e17425df93a56495bb2")
148
+ end
149
+
150
+ it "responds successfully to a request for a jpg" do
151
+ response = @request.get("/assets/images/my-jpg.jpg")
39
152
 
40
153
  expect(response).to be_ok
41
- expect(response.body).to match(/<h1>Subdirectory Index/)
154
+ expect(response.content_type).to eql("image/jpeg")
155
+ expect(Digest::SHA1.hexdigest(response.body)).to eql("ae6a26b513d6648446da1395ee73e9cf32c8c668")
42
156
  end
43
157
 
44
- it 'responds successfully to a request for a different page in the subdirectory' do
45
- response = @request.get('/subdir1/kanye')
158
+ it "responds successfully to a request for a png" do
159
+ response = @request.get("/assets/images/my-png.png")
46
160
 
47
161
  expect(response).to be_ok
48
- expect(response.body).to match(/<h1>Hurry up with my damn croissant/)
162
+ expect(response.content_type).to eql("image/png")
163
+ expect(Digest::SHA1.hexdigest(response.body)).to eql("adf65c25a8e3e39c49ecf581433278d7eac4d1a2")
164
+ end
165
+
166
+ it "404s on a request for an asset without namespacing by type" do
167
+ response = @request.get("/assets/app.js")
168
+ expect(response).to be_not_found
169
+ end
170
+
171
+ it "404s on a request for an asset namespaced by the wrong type" do
172
+ response = @request.get("/assets/stylesheets/app.js")
173
+ expect(response).to be_not_found
174
+ end
175
+
176
+ it "404s on a request for an asset namespaced by an unknown type" do
177
+ response = @request.get("/assets/shouldfail/shouldfail.css")
178
+ expect(response).to be_not_found
179
+ end
180
+
181
+ it "404s on a request for a nonexistent asset" do
182
+ response = @request.get("/assets/javascripts/nonexistent.js")
183
+
184
+ expect(response).to be_not_found
49
185
  end
50
186
  end
51
187
  end
@@ -0,0 +1 @@
1
+ //= require_tree
@@ -0,0 +1 @@
1
+ alert "such javascript wow"
@@ -0,0 +1,3 @@
1
+ div {
2
+ display: none;
3
+ }
@@ -0,0 +1 @@
1
+ //= require_tree
@@ -0,0 +1,3 @@
1
+ div {
2
+ display: block;
3
+ }
@@ -0,0 +1,7 @@
1
+ <h2>This is the root page for the app with assets!</h2>
2
+
3
+ <p>How u doin. Check out these images in 3 different formats.</p>
4
+
5
+ <img src="/assets/my-gif.gif" alt="My GIF">
6
+ <img src="/assets/my-jpg.jpg" alt="My JPEG">
7
+ <img src="/assets/my-png.png" alt="My PNG">
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>App With Assets</title>
5
+
6
+ <link href="/assets/app.css" media="all" rel="stylesheet" type="text/css">
7
+ <script src="/assets/app.js" type="text/javascript"></script>
8
+ </head>
9
+
10
+ <body>
11
+ <h1>This app has so many assets</h1>
12
+
13
+ <%= yield %>
14
+ </body>
15
+ </html>
@@ -0,0 +1 @@
1
+ alert("i am vendored");
@@ -0,0 +1,3 @@
1
+ div {
2
+ margin: 0;
3
+ }
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>ERB</title>
5
+ </head>
6
+
7
+ <body>
8
+ <h1>I was born on <%= Time.utc(1985, 12, 21).strftime('%B %e') %></h1>
9
+ </body>
10
+ </html>
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>ERB</title>
5
+ </head>
6
+
7
+ <body>
8
+ <h1><%= "we are using erb".upcase %></h1>
9
+ </body>
10
+ </html>
@@ -0,0 +1,3 @@
1
+ <h2>This is the root page!</h2>
2
+
3
+ <p>Sup.</p>
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>App With Layouts</title>
5
+ </head>
6
+
7
+ <body>
8
+ <h1>Layout Header</h1>
9
+
10
+ <%= yield %>
11
+ </body>
12
+ </html>
@@ -0,0 +1,3 @@
1
+ <h2>This is a page in a subdirectory!</h2>
2
+
3
+ <p>How u doin.</p>
@@ -0,0 +1,3 @@
1
+ <h2>This part of the root page is not in a partial!</h2>
2
+
3
+ <%= render "subdir/partial" %>
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>App With Partials</title>
5
+ </head>
6
+
7
+ <body>
8
+ <h1>Partials work in this app</h1>
9
+
10
+ <%= yield %>
11
+ </body>
12
+ </html>
@@ -0,0 +1 @@
1
+ <p>This is coming from a partial.</p>
@@ -0,0 +1,3 @@
1
+ <h2>This is a page in a subdirectory!</h2>
2
+
3
+ <p>How u doin.</p>
@@ -0,0 +1,3 @@
1
+ <h2>This is not the root!</h2>
2
+
3
+ <p>But it's still cool.</p>
@@ -1,8 +1,8 @@
1
- require 'hyperloop'
1
+ require File.expand_path("../spec_helper", __FILE__)
2
2
 
3
3
  describe Hyperloop::Response do
4
- it 'has a body' do
5
- response = Hyperloop::Response.new('irrelevant')
4
+ it "has a body" do
5
+ response = Hyperloop::Response.new("irrelevant")
6
6
  expect(response.body).not_to be_empty
7
7
  end
8
8
  end