noumenon 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +3 -0
- data/.travis.yml +0 -4
- data/.yardopts +5 -0
- data/Gemfile +1 -3
- data/README.md +57 -80
- data/Rakefile +17 -6
- data/bin/noumenon +6 -0
- data/features/dynamic_template_rendering.feature +107 -0
- data/features/generator/site_generator.feature +25 -0
- data/features/mounted_applications.feature +30 -0
- data/features/static_template_rendering.feature +43 -0
- data/features/step_definitions/asset_steps.rb +7 -0
- data/features/step_definitions/content_steps.rb +7 -0
- data/features/step_definitions/generator_steps.rb +22 -0
- data/features/step_definitions/request_steps.rb +31 -0
- data/features/step_definitions/theme_steps.rb +19 -0
- data/features/support/env.rb +38 -0
- data/features/support/theme/theme.yml +5 -0
- data/features/theme_assets.feature +22 -0
- data/generators/repository/index.yml +3 -0
- data/generators/site/Gemfile +3 -0
- data/generators/site/config.ru +7 -0
- data/generators/theme/assets/style.css +1 -0
- data/generators/theme/layouts/default.nou.html +23 -0
- data/generators/theme/templates/default.nou.html +12 -0
- data/generators/theme/theme.yml +5 -0
- data/lib/noumenon/cli.rb +27 -0
- data/lib/noumenon/core.rb +70 -77
- data/lib/noumenon/repository/file_system.rb +102 -0
- data/lib/noumenon/repository.rb +39 -0
- data/lib/noumenon/spec/example_app.rb +19 -6
- data/lib/noumenon/spec/theme_helpers.rb +66 -0
- data/lib/noumenon/spec.rb +4 -7
- data/lib/noumenon/string_extensions.rb +21 -0
- data/lib/noumenon/template.rb +113 -72
- data/lib/noumenon/theme/assets_middleware.rb +21 -0
- data/lib/noumenon/theme.rb +106 -0
- data/lib/noumenon/version.rb +3 -1
- data/lib/noumenon.rb +68 -100
- data/noumenon.gemspec +13 -9
- data/spec/noumenon/repository/file_system_spec.rb +115 -0
- data/spec/noumenon/repository_spec.rb +40 -0
- data/spec/noumenon/template_spec.rb +9 -7
- data/spec/noumenon/theme_spec.rb +129 -0
- data/spec/noumenon_spec.rb +24 -80
- data/spec/spec_helper.rb +5 -14
- data/spec/support/file_matchers.rb +45 -0
- data/spec/support/templates/basic_template.html +1 -0
- data/spec/{fixtures/themes/example_without_layout → support}/templates/template_with_fields.html +1 -1
- metadata +143 -62
- data/lib/noumenon/configuration.rb +0 -28
- data/lib/noumenon/spec/fixtures.rb +0 -34
- data/spec/fixtures/fixture_specs/test +0 -1
- data/spec/fixtures/missing_application/mounted_app/config.yml +0 -1
- data/spec/fixtures/static_example/directory_with_index/index.yml +0 -1
- data/spec/fixtures/static_example/found.html +0 -1
- data/spec/fixtures/static_example/liquid_example.html +0 -1
- data/spec/fixtures/static_example/mounted_app/config.yml +0 -1
- data/spec/fixtures/static_example/template_with_substitutions.html +0 -1
- data/spec/fixtures/static_example/templates/basic_example.yml +0 -1
- data/spec/fixtures/static_example/templates/with_fields.yml +0 -2
- data/spec/fixtures/themes/example/assets/example.txt +0 -1
- data/spec/fixtures/themes/example/templates/layout.html +0 -3
- data/spec/fixtures/themes/example_without_layout/templates/basic_template.html +0 -1
- data/spec/fixtures/themes/example_without_layout/templates/fields.html +0 -1
- data/spec/fixtures/themes/external_theme/assets/example.txt +0 -1
- data/spec/fixtures/themes/unregistered/lib/unregistered.rb +0 -1
- data/spec/noumenon/config_spec.rb +0 -29
- data/spec/noumenon/core_spec.rb +0 -105
- data/spec/noumenon/spec/example_app_spec.rb +0 -14
- data/spec/noumenon/spec/fixtures_spec.rb +0 -41
- data/spec/noumenon/spec_spec.rb +0 -7
- data/watchr.rb +0 -2
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: noumenon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0
|
5
|
+
version: 0.1.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jon Wood
|
@@ -10,18 +10,18 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-05-25 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
17
|
+
name: facets
|
18
18
|
prerelease: false
|
19
19
|
requirement: &id001 !ruby/object:Gem::Requirement
|
20
20
|
none: false
|
21
21
|
requirements:
|
22
22
|
- - ">="
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version:
|
24
|
+
version: 2.9.1
|
25
25
|
type: :runtime
|
26
26
|
version_requirements: *id001
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -36,30 +36,107 @@ dependencies:
|
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id002
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
|
-
name:
|
39
|
+
name: sinatra
|
40
40
|
prerelease: false
|
41
41
|
requirement: &id003 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 2.
|
47
|
-
type: :
|
46
|
+
version: 1.2.3
|
47
|
+
type: :runtime
|
48
48
|
version_requirements: *id003
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
|
-
name:
|
50
|
+
name: aruba
|
51
51
|
prerelease: false
|
52
52
|
requirement: &id004 !ruby/object:Gem::Requirement
|
53
53
|
none: false
|
54
54
|
requirements:
|
55
55
|
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version:
|
57
|
+
version: 0.3.6
|
58
58
|
type: :development
|
59
59
|
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: capybara
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.0.beta1
|
69
|
+
type: :development
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: cucumber
|
73
|
+
prerelease: false
|
74
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 0.10.2
|
80
|
+
type: :development
|
81
|
+
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: rake
|
84
|
+
prerelease: false
|
85
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 0.9.0
|
91
|
+
type: :development
|
92
|
+
version_requirements: *id007
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: rdiscount
|
95
|
+
prerelease: false
|
96
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 1.6.8
|
102
|
+
type: :development
|
103
|
+
version_requirements: *id008
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: rspec
|
106
|
+
prerelease: false
|
107
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 2.5.0
|
113
|
+
type: :development
|
114
|
+
version_requirements: *id009
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: thor
|
117
|
+
prerelease: false
|
118
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 0.14.6
|
124
|
+
type: :development
|
125
|
+
version_requirements: *id010
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: yard
|
128
|
+
prerelease: false
|
129
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: 0.7.1
|
135
|
+
type: :development
|
136
|
+
version_requirements: *id011
|
60
137
|
description: |
|
61
|
-
Noumenon is a content management system designed to
|
62
|
-
|
138
|
+
Noumenon is a content management system designed to support being extended with Sinatra
|
139
|
+
applications.
|
63
140
|
|
64
141
|
It's currently in an early stage of development, but right now you can create a basic
|
65
142
|
static site using templates from a theme which specify the structure and presentation
|
@@ -69,14 +146,11 @@ description: |
|
|
69
146
|
Future development will include an end-user friendly web interface for editing and
|
70
147
|
creating content, while retaining the ability for developers and designers to manage
|
71
148
|
the site's presentation using the tools they're most comfortable with.
|
72
|
-
|
73
|
-
See http://github.com/Noumenon/example-app/ for a really bare bones example of how
|
74
|
-
Noumenon works.
|
75
149
|
|
76
150
|
email:
|
77
151
|
- jon@blankpad.net
|
78
|
-
executables:
|
79
|
-
|
152
|
+
executables:
|
153
|
+
- noumenon
|
80
154
|
extensions: []
|
81
155
|
|
82
156
|
extra_rdoc_files: []
|
@@ -84,44 +158,54 @@ extra_rdoc_files: []
|
|
84
158
|
files:
|
85
159
|
- .gitignore
|
86
160
|
- .travis.yml
|
161
|
+
- .yardopts
|
87
162
|
- Gemfile
|
88
163
|
- MIT-LICENSE
|
89
164
|
- README.md
|
90
165
|
- Rakefile
|
166
|
+
- bin/noumenon
|
167
|
+
- features/dynamic_template_rendering.feature
|
168
|
+
- features/generator/site_generator.feature
|
169
|
+
- features/mounted_applications.feature
|
170
|
+
- features/static_template_rendering.feature
|
171
|
+
- features/step_definitions/asset_steps.rb
|
172
|
+
- features/step_definitions/content_steps.rb
|
173
|
+
- features/step_definitions/generator_steps.rb
|
174
|
+
- features/step_definitions/request_steps.rb
|
175
|
+
- features/step_definitions/theme_steps.rb
|
176
|
+
- features/support/env.rb
|
177
|
+
- features/support/theme/theme.yml
|
178
|
+
- features/theme_assets.feature
|
179
|
+
- generators/repository/index.yml
|
180
|
+
- generators/site/Gemfile
|
181
|
+
- generators/site/config.ru
|
182
|
+
- generators/theme/assets/style.css
|
183
|
+
- generators/theme/layouts/default.nou.html
|
184
|
+
- generators/theme/templates/default.nou.html
|
185
|
+
- generators/theme/theme.yml
|
91
186
|
- lib/noumenon.rb
|
92
|
-
- lib/noumenon/
|
187
|
+
- lib/noumenon/cli.rb
|
93
188
|
- lib/noumenon/core.rb
|
189
|
+
- lib/noumenon/repository.rb
|
190
|
+
- lib/noumenon/repository/file_system.rb
|
94
191
|
- lib/noumenon/spec.rb
|
95
192
|
- lib/noumenon/spec/example_app.rb
|
96
|
-
- lib/noumenon/spec/
|
193
|
+
- lib/noumenon/spec/theme_helpers.rb
|
194
|
+
- lib/noumenon/string_extensions.rb
|
97
195
|
- lib/noumenon/template.rb
|
196
|
+
- lib/noumenon/theme.rb
|
197
|
+
- lib/noumenon/theme/assets_middleware.rb
|
98
198
|
- lib/noumenon/version.rb
|
99
199
|
- noumenon.gemspec
|
100
|
-
- spec/
|
101
|
-
- spec/
|
102
|
-
- spec/fixtures/static_example/directory_with_index/index.yml
|
103
|
-
- spec/fixtures/static_example/found.html
|
104
|
-
- spec/fixtures/static_example/liquid_example.html
|
105
|
-
- spec/fixtures/static_example/mounted_app/config.yml
|
106
|
-
- spec/fixtures/static_example/template_with_substitutions.html
|
107
|
-
- spec/fixtures/static_example/templates/basic_example.yml
|
108
|
-
- spec/fixtures/static_example/templates/with_fields.yml
|
109
|
-
- spec/fixtures/themes/example/assets/example.txt
|
110
|
-
- spec/fixtures/themes/example/templates/layout.html
|
111
|
-
- spec/fixtures/themes/example_without_layout/templates/basic_template.html
|
112
|
-
- spec/fixtures/themes/example_without_layout/templates/fields.html
|
113
|
-
- spec/fixtures/themes/example_without_layout/templates/template_with_fields.html
|
114
|
-
- spec/fixtures/themes/external_theme/assets/example.txt
|
115
|
-
- spec/fixtures/themes/unregistered/lib/unregistered.rb
|
116
|
-
- spec/noumenon/config_spec.rb
|
117
|
-
- spec/noumenon/core_spec.rb
|
118
|
-
- spec/noumenon/spec/example_app_spec.rb
|
119
|
-
- spec/noumenon/spec/fixtures_spec.rb
|
120
|
-
- spec/noumenon/spec_spec.rb
|
200
|
+
- spec/noumenon/repository/file_system_spec.rb
|
201
|
+
- spec/noumenon/repository_spec.rb
|
121
202
|
- spec/noumenon/template_spec.rb
|
203
|
+
- spec/noumenon/theme_spec.rb
|
122
204
|
- spec/noumenon_spec.rb
|
123
205
|
- spec/spec_helper.rb
|
124
|
-
-
|
206
|
+
- spec/support/file_matchers.rb
|
207
|
+
- spec/support/templates/basic_template.html
|
208
|
+
- spec/support/templates/template_with_fields.html
|
125
209
|
has_rdoc: true
|
126
210
|
homepage: https://github.com/Noumenon
|
127
211
|
licenses: []
|
@@ -149,29 +233,26 @@ rubyforge_project: noumenon
|
|
149
233
|
rubygems_version: 1.6.2
|
150
234
|
signing_key:
|
151
235
|
specification_version: 3
|
152
|
-
summary:
|
236
|
+
summary: A flexible content management system.
|
153
237
|
test_files:
|
154
|
-
-
|
155
|
-
-
|
156
|
-
-
|
157
|
-
-
|
158
|
-
-
|
159
|
-
-
|
160
|
-
-
|
161
|
-
-
|
162
|
-
-
|
163
|
-
-
|
164
|
-
-
|
165
|
-
-
|
166
|
-
- spec/
|
167
|
-
- spec/
|
168
|
-
- spec/fixtures/themes/external_theme/assets/example.txt
|
169
|
-
- spec/fixtures/themes/unregistered/lib/unregistered.rb
|
170
|
-
- spec/noumenon/config_spec.rb
|
171
|
-
- spec/noumenon/core_spec.rb
|
172
|
-
- spec/noumenon/spec/example_app_spec.rb
|
173
|
-
- spec/noumenon/spec/fixtures_spec.rb
|
174
|
-
- spec/noumenon/spec_spec.rb
|
238
|
+
- features/dynamic_template_rendering.feature
|
239
|
+
- features/generator/site_generator.feature
|
240
|
+
- features/mounted_applications.feature
|
241
|
+
- features/static_template_rendering.feature
|
242
|
+
- features/step_definitions/asset_steps.rb
|
243
|
+
- features/step_definitions/content_steps.rb
|
244
|
+
- features/step_definitions/generator_steps.rb
|
245
|
+
- features/step_definitions/request_steps.rb
|
246
|
+
- features/step_definitions/theme_steps.rb
|
247
|
+
- features/support/env.rb
|
248
|
+
- features/support/theme/theme.yml
|
249
|
+
- features/theme_assets.feature
|
250
|
+
- spec/noumenon/repository/file_system_spec.rb
|
251
|
+
- spec/noumenon/repository_spec.rb
|
175
252
|
- spec/noumenon/template_spec.rb
|
253
|
+
- spec/noumenon/theme_spec.rb
|
176
254
|
- spec/noumenon_spec.rb
|
177
255
|
- spec/spec_helper.rb
|
256
|
+
- spec/support/file_matchers.rb
|
257
|
+
- spec/support/templates/basic_template.html
|
258
|
+
- spec/support/templates/template_with_fields.html
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module Noumenon
|
2
|
-
# Handles configuration for a Noumenon application.
|
3
|
-
class Configuration
|
4
|
-
class ThemeNotFoundError < StandardError; end
|
5
|
-
|
6
|
-
# The path to load content from.
|
7
|
-
attr_accessor :content_repository_path
|
8
|
-
|
9
|
-
# The theme to use.
|
10
|
-
attr_accessor :theme
|
11
|
-
|
12
|
-
# Sets the current theme.
|
13
|
-
#
|
14
|
-
# If the theme could not be found under dependencies_path then a ThemeNotFoundError will be raised.
|
15
|
-
def theme=(value)
|
16
|
-
begin
|
17
|
-
require value.gsub("-", "/")
|
18
|
-
rescue LoadError => e
|
19
|
-
end
|
20
|
-
|
21
|
-
unless Noumenon.themes.key?(value)
|
22
|
-
raise ThemeNotFoundError.new("The theme #{value} has not been registered.")
|
23
|
-
end
|
24
|
-
|
25
|
-
@theme = value
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
|
3
|
-
module Noumenon
|
4
|
-
module Spec
|
5
|
-
# Provides a simple way of mocking a content repository for specs.
|
6
|
-
module Fixtures
|
7
|
-
# The current path that fixtures are looked up from.
|
8
|
-
def fixture_path(path = nil)
|
9
|
-
@fixture_path ||= 'spec/fixtures'
|
10
|
-
path.nil? ? @fixture_path : File.join(@fixture_path, path)
|
11
|
-
end
|
12
|
-
|
13
|
-
# Set the path that fixtures will be looked up from.
|
14
|
-
#
|
15
|
-
# Unless set to an absolute path the provided path will be assumed to be a sub-directory
|
16
|
-
# of "spec/fixtures".
|
17
|
-
def fixture_path=(value)
|
18
|
-
value = File.join("spec/fixtures", value) unless Pathname.new(value).absolute?
|
19
|
-
@fixture_path = value
|
20
|
-
end
|
21
|
-
|
22
|
-
# Loads a fixture from the specified path.
|
23
|
-
#
|
24
|
-
# Example:
|
25
|
-
#
|
26
|
-
# File.write(File.join(fixture_path, "index.html"), "<h1>Hello, world!</h1>")
|
27
|
-
# fixture("index.html")
|
28
|
-
# # => "<h1>Hello, world!</h1>"
|
29
|
-
def fixture(path)
|
30
|
-
File.read File.join(fixture_path, path)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
Hello, fixtures.
|
@@ -1 +0,0 @@
|
|
1
|
-
application: "NonExistantApplication"
|
@@ -1 +0,0 @@
|
|
1
|
-
template: "basic_template"
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>Hello</h1>
|
@@ -1 +0,0 @@
|
|
1
|
-
Hello liquid.
|
@@ -1 +0,0 @@
|
|
1
|
-
application: "Noumenon::Spec::ExampleApp"
|
@@ -1 +0,0 @@
|
|
1
|
-
Hello, {{ name }}
|
@@ -1 +0,0 @@
|
|
1
|
-
template: "basic_template"
|
@@ -1 +0,0 @@
|
|
1
|
-
Hello, world.
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>This is a Basic Template</h1>
|
@@ -1 +0,0 @@
|
|
1
|
-
Field: {{ example_field }}
|
@@ -1 +0,0 @@
|
|
1
|
-
This is example.txt in the external_theme theme.
|
@@ -1 +0,0 @@
|
|
1
|
-
Noumenon.register_theme "unregistered", File.expand_path("../..", __FILE__)
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Noumenon::Configuration do
|
4
|
-
it { should_not be_nil }
|
5
|
-
|
6
|
-
it { should respond_to(:content_repository_path) }
|
7
|
-
it { should respond_to(:content_repository_path=) }
|
8
|
-
|
9
|
-
it { should respond_to(:theme) }
|
10
|
-
it { should respond_to(:theme=) }
|
11
|
-
|
12
|
-
describe "setting the theme" do
|
13
|
-
it "succeeds if the theme exists" do
|
14
|
-
subject.theme = "example"
|
15
|
-
subject.theme.should == "example"
|
16
|
-
end
|
17
|
-
|
18
|
-
it "raises an exception if the theme has not been registered" do
|
19
|
-
lambda { subject.theme = "none_existant" }.should raise_error Noumenon::Configuration::ThemeNotFoundError
|
20
|
-
end
|
21
|
-
|
22
|
-
it "automatically requires a theme if it can be found" do
|
23
|
-
$: << fixture_path("themes/unregistered/lib")
|
24
|
-
|
25
|
-
subject.theme = "unregistered"
|
26
|
-
subject.theme.should == "unregistered"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/spec/noumenon/core_spec.rb
DELETED
@@ -1,105 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Noumenon::Core do
|
4
|
-
def app
|
5
|
-
Noumenon::Core.new
|
6
|
-
end
|
7
|
-
|
8
|
-
describe "accessing configuration" do
|
9
|
-
it { should respond_to(:config) }
|
10
|
-
it "returns the global configuration when calling config" do
|
11
|
-
app.config.should == Noumenon.config
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe "retrieving paths" do
|
16
|
-
it { should respond_to(:content_path) }
|
17
|
-
|
18
|
-
it "locate a path in the content repository" do
|
19
|
-
app.content_path("example").should == "#{app.config.content_repository_path}/example"
|
20
|
-
end
|
21
|
-
|
22
|
-
it { should respond_to(:theme_path) }
|
23
|
-
|
24
|
-
it "can locate a path in the theme directory" do
|
25
|
-
app.theme_path("file").should == fixture_path("themes/example/file")
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "rendering a template" do
|
30
|
-
it { should respond_to(:render_template) }
|
31
|
-
|
32
|
-
context "when the theme has no layout" do
|
33
|
-
before(:each) { app.config.theme = "example_without_layout" }
|
34
|
-
|
35
|
-
it "renders the requested template if it does exist" do
|
36
|
-
app.render_template( app.content_path("found.html") ).should == fixture("static_example/found.html")
|
37
|
-
end
|
38
|
-
|
39
|
-
it "uses Liquid to replace any tags in the template" do
|
40
|
-
app.render_template( app.content_path("template_with_substitutions.html"), 'name' => 'Jon' ).should == "Hello, Jon\n"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context "when the theme has a layout" do
|
45
|
-
before(:each) { app.config.theme = "example" }
|
46
|
-
|
47
|
-
it "renders the template within the theme's layout by default" do
|
48
|
-
app.render_template( app.content_path("found.html") ).should == %Q{<div id="layout">\n#{fixture("static_example/found.html")}\n</div>\n}
|
49
|
-
end
|
50
|
-
|
51
|
-
it "ignores the layout if the option :layout => false is passed" do
|
52
|
-
app.render_template( app.content_path("found.html"), {}, :layout => false ).should == fixture("static_example/found.html")
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe "serving content from the content repository" do
|
58
|
-
before(:each) { app.config.theme = "example_without_layout" }
|
59
|
-
|
60
|
-
context "when the requested item does not exist" do
|
61
|
-
context "and an index file exists in a directory of the same name" do
|
62
|
-
it "renders the index file instead" do
|
63
|
-
get "/directory_with_index"
|
64
|
-
|
65
|
-
last_response.should be_ok
|
66
|
-
last_response.body.should == File.read(app.theme_path("templates/basic_template.html"))
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
context "and no index file exists in a directory of the same name" do
|
71
|
-
it "responds with a status of 404" do
|
72
|
-
get "/empty_directory"
|
73
|
-
|
74
|
-
last_response.should_not be_ok
|
75
|
-
last_response.status.should == 404
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
context "and no directory of the same name exists" do
|
80
|
-
it "responds with a status of 404" do
|
81
|
-
get "/not_found"
|
82
|
-
|
83
|
-
last_response.should_not be_ok
|
84
|
-
last_response.status.should == 404
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
context "when the requested item exists" do
|
90
|
-
it "renders the specified template from the theme" do
|
91
|
-
get "/templates/basic_example"
|
92
|
-
|
93
|
-
last_response.should be_ok
|
94
|
-
last_response.body.should == File.read(app.theme_path("templates/basic_template.html"))
|
95
|
-
end
|
96
|
-
|
97
|
-
it "makes substitutions as specified in the template" do
|
98
|
-
get "/templates/with_fields"
|
99
|
-
|
100
|
-
last_response.should be_ok
|
101
|
-
last_response.body.should =~ /Field: value/
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Noumenon::Spec::ExampleApp do
|
4
|
-
it { should_not be_nil }
|
5
|
-
|
6
|
-
def app
|
7
|
-
Noumenon::Spec::ExampleApp.new
|
8
|
-
end
|
9
|
-
|
10
|
-
it "returns a simple message on a GET to /" do
|
11
|
-
get "/"
|
12
|
-
last_response.body.should == "This was served by Noumenon::Spec::ExampleApp"
|
13
|
-
end
|
14
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'noumenon/spec/fixtures'
|
2
|
-
|
3
|
-
class FixturedSpec
|
4
|
-
include Noumenon::Spec::Fixtures
|
5
|
-
end
|
6
|
-
|
7
|
-
describe "a class with Noumenon::Spec::Fixtures mixed in" do
|
8
|
-
subject { FixturedSpec.new }
|
9
|
-
|
10
|
-
describe "the fixture path" do
|
11
|
-
it { should respond_to(:fixture_path) }
|
12
|
-
it { should respond_to(:fixture_path=) }
|
13
|
-
|
14
|
-
it "defaults the fixture path to 'spec/fixtures'" do
|
15
|
-
subject.fixture_path.should == 'spec/fixtures'
|
16
|
-
end
|
17
|
-
|
18
|
-
it "appends the provided path to spec/fixtures if relative" do
|
19
|
-
subject.fixture_path = "test"
|
20
|
-
subject.fixture_path.should == "spec/fixtures/test"
|
21
|
-
end
|
22
|
-
|
23
|
-
it "sets the path provided if absolute" do
|
24
|
-
subject.fixture_path = "/tmp"
|
25
|
-
subject.fixture_path.should == "/tmp"
|
26
|
-
end
|
27
|
-
|
28
|
-
it "returns the full path to the fixture if fixture_path is passed an argument" do
|
29
|
-
subject.fixture_path = "/tmp"
|
30
|
-
subject.fixture_path("example").should == "/tmp/example"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "loading a fixture" do
|
35
|
-
it { should respond_to(:fixture) }
|
36
|
-
|
37
|
-
it "returns the contents of the specified file" do
|
38
|
-
subject.fixture("fixture_specs/test").should eq "Hello, fixtures.\n"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
data/spec/noumenon/spec_spec.rb
DELETED
data/watchr.rb
DELETED