high_voltage 3.1.1 → 4.0.0.rc1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +64 -42
- data/CONTRIBUTING.md +43 -18
- data/README.md +22 -12
- data/lib/high_voltage/engine.rb +0 -7
- data/lib/high_voltage/version.rb +1 -1
- metadata +13 -109
- data/.gitignore +0 -7
- data/.travis.yml +0 -25
- data/Appraisals +0 -15
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -114
- data/Rakefile +0 -24
- data/bin/setup +0 -12
- data/gemfiles/rails_4.2.gemfile +0 -7
- data/gemfiles/rails_5.0.gemfile +0 -8
- data/gemfiles/rails_5.1.gemfile +0 -8
- data/gemfiles/rails_5.2.gemfile +0 -8
- data/high_voltage.gemspec +0 -24
- data/spec/constraints/root_route_spec.rb +0 -29
- data/spec/controllers/alternative_finder_controller_spec.rb +0 -12
- data/spec/controllers/pages_controller_spec.rb +0 -113
- data/spec/controllers/subclassed_pages_controller_spec.rb +0 -34
- data/spec/fake_app.rb +0 -16
- data/spec/features/current_page_helper_spec.rb +0 -9
- data/spec/features/view_page_spec.rb +0 -9
- data/spec/fixtures/app/views/layouts/alternate.html.erb +0 -14
- data/spec/fixtures/app/views/layouts/application.html.erb +0 -14
- data/spec/fixtures/app/views/other/wrong.html.erb +0 -1
- data/spec/fixtures/app/views/other_pages/also_dir/also_nested.html.erb +0 -1
- data/spec/fixtures/app/views/other_pages/also_exists.html.erb +0 -1
- data/spec/fixtures/app/views/other_pages/also_exists_but_references_nonexistent_partial.html.erb +0 -2
- data/spec/fixtures/app/views/pages/_partial.html.erb +0 -1
- data/spec/fixtures/app/views/pages/about.html.erb +0 -1
- data/spec/fixtures/app/views/pages/also_dir/also_nested.html.erb +0 -1
- data/spec/fixtures/app/views/pages/also_exists.html.erb +0 -1
- data/spec/fixtures/app/views/pages/also_exists_but_references_nonexistent_partial.html.erb +0 -2
- data/spec/fixtures/app/views/pages/current_page_helper.html.erb +0 -1
- data/spec/fixtures/app/views/pages/dir/nested.html.erb +0 -1
- data/spec/fixtures/app/views/pages/exists.html.erb +0 -1
- data/spec/fixtures/app/views/pages/exists_but_references_nonexistent_partial.html.erb +0 -2
- data/spec/fixtures/app/views/pages/exists_without_html_extension.erb +0 -1
- data/spec/fixtures/app/views/pages/rot13.html.erb +0 -1
- data/spec/fixtures/app/views/pages/text.txt.erb +0 -1
- data/spec/fixtures/config/database.yml +0 -3
- data/spec/fixtures/config/routes.rb +0 -4
- data/spec/fixtures/public/pages/exists.html +0 -0
- data/spec/high_voltage/configuration_spec.rb +0 -31
- data/spec/high_voltage/page_collector_spec.rb +0 -40
- data/spec/high_voltage/page_finder_spec.rb +0 -98
- data/spec/high_voltage/page_spec.rb +0 -65
- data/spec/high_voltage_spec.rb +0 -11
- data/spec/integration/navigation_spec.rb +0 -7
- data/spec/minimal_spec_helper.rb +0 -5
- data/spec/requests/home_page_spec.rb +0 -13
- data/spec/routing/routes_spec.rb +0 -140
- data/spec/spec_helper.rb +0 -39
- data/spec/support/app/controllers/alternative_finder_controller.rb +0 -14
- data/spec/support/app/controllers/subclassed_pages_controller.rb +0 -3
- data/spec/support/http_method_shim.rb +0 -19
data/Gemfile.lock
DELETED
@@ -1,114 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
high_voltage (3.1.1)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
actionpack (5.2.3)
|
10
|
-
actionview (= 5.2.3)
|
11
|
-
activesupport (= 5.2.3)
|
12
|
-
rack (~> 2.0)
|
13
|
-
rack-test (>= 0.6.3)
|
14
|
-
rails-dom-testing (~> 2.0)
|
15
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
16
|
-
actionview (5.2.3)
|
17
|
-
activesupport (= 5.2.3)
|
18
|
-
builder (~> 3.1)
|
19
|
-
erubi (~> 1.4)
|
20
|
-
rails-dom-testing (~> 2.0)
|
21
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
22
|
-
activesupport (5.2.3)
|
23
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
24
|
-
i18n (>= 0.7, < 2)
|
25
|
-
minitest (~> 5.1)
|
26
|
-
tzinfo (~> 1.1)
|
27
|
-
addressable (2.6.0)
|
28
|
-
public_suffix (>= 2.0.2, < 4.0)
|
29
|
-
appraisal (2.2.0)
|
30
|
-
bundler
|
31
|
-
rake
|
32
|
-
thor (>= 0.14.0)
|
33
|
-
builder (3.2.3)
|
34
|
-
capybara (3.19.1)
|
35
|
-
addressable
|
36
|
-
mini_mime (>= 0.1.3)
|
37
|
-
nokogiri (~> 1.8)
|
38
|
-
rack (>= 1.6.0)
|
39
|
-
rack-test (>= 0.6.3)
|
40
|
-
regexp_parser (~> 1.2)
|
41
|
-
xpath (~> 3.2)
|
42
|
-
coderay (1.1.2)
|
43
|
-
concurrent-ruby (1.1.5)
|
44
|
-
crass (1.0.4)
|
45
|
-
diff-lcs (1.3)
|
46
|
-
erubi (1.8.0)
|
47
|
-
i18n (1.6.0)
|
48
|
-
concurrent-ruby (~> 1.0)
|
49
|
-
loofah (2.2.3)
|
50
|
-
crass (~> 1.0.2)
|
51
|
-
nokogiri (>= 1.5.9)
|
52
|
-
method_source (0.9.2)
|
53
|
-
mini_mime (1.0.1)
|
54
|
-
mini_portile2 (2.4.0)
|
55
|
-
minitest (5.11.3)
|
56
|
-
nokogiri (1.10.3)
|
57
|
-
mini_portile2 (~> 2.4.0)
|
58
|
-
pry (0.12.2)
|
59
|
-
coderay (~> 1.1.0)
|
60
|
-
method_source (~> 0.9.0)
|
61
|
-
public_suffix (3.0.3)
|
62
|
-
rack (2.0.7)
|
63
|
-
rack-test (1.1.0)
|
64
|
-
rack (>= 1.0, < 3)
|
65
|
-
rails-dom-testing (2.0.3)
|
66
|
-
activesupport (>= 4.2.0)
|
67
|
-
nokogiri (>= 1.6)
|
68
|
-
rails-html-sanitizer (1.0.4)
|
69
|
-
loofah (~> 2.2, >= 2.2.2)
|
70
|
-
railties (5.2.3)
|
71
|
-
actionpack (= 5.2.3)
|
72
|
-
activesupport (= 5.2.3)
|
73
|
-
method_source
|
74
|
-
rake (>= 0.8.7)
|
75
|
-
thor (>= 0.19.0, < 2.0)
|
76
|
-
rake (12.3.2)
|
77
|
-
regexp_parser (1.4.0)
|
78
|
-
rspec-core (3.8.0)
|
79
|
-
rspec-support (~> 3.8.0)
|
80
|
-
rspec-expectations (3.8.3)
|
81
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
82
|
-
rspec-support (~> 3.8.0)
|
83
|
-
rspec-mocks (3.8.0)
|
84
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
85
|
-
rspec-support (~> 3.8.0)
|
86
|
-
rspec-rails (3.8.2)
|
87
|
-
actionpack (>= 3.0)
|
88
|
-
activesupport (>= 3.0)
|
89
|
-
railties (>= 3.0)
|
90
|
-
rspec-core (~> 3.8.0)
|
91
|
-
rspec-expectations (~> 3.8.0)
|
92
|
-
rspec-mocks (~> 3.8.0)
|
93
|
-
rspec-support (~> 3.8.0)
|
94
|
-
rspec-support (3.8.0)
|
95
|
-
thor (0.20.3)
|
96
|
-
thread_safe (0.3.6)
|
97
|
-
tzinfo (1.2.5)
|
98
|
-
thread_safe (~> 0.1)
|
99
|
-
xpath (3.2.0)
|
100
|
-
nokogiri (~> 1.8)
|
101
|
-
|
102
|
-
PLATFORMS
|
103
|
-
ruby
|
104
|
-
|
105
|
-
DEPENDENCIES
|
106
|
-
activesupport (>= 3.1.0)
|
107
|
-
appraisal
|
108
|
-
capybara
|
109
|
-
high_voltage!
|
110
|
-
pry
|
111
|
-
rspec-rails (~> 3.5)
|
112
|
-
|
113
|
-
BUNDLED WITH
|
114
|
-
1.17.3
|
data/Rakefile
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bundler/setup'
|
5
|
-
require 'bundler/gem_tasks'
|
6
|
-
|
7
|
-
require 'rake'
|
8
|
-
require 'rspec/core/rake_task'
|
9
|
-
require 'appraisal'
|
10
|
-
|
11
|
-
RSpec::Core::RakeTask.new(:spec)
|
12
|
-
|
13
|
-
desc 'Default'
|
14
|
-
task :default do
|
15
|
-
if ENV['BUNDLE_GEMFILE'] =~ /gemfiles/
|
16
|
-
Rake::Task['spec'].invoke
|
17
|
-
else
|
18
|
-
Rake::Task['appraise'].invoke
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
task :appraise do
|
23
|
-
exec 'appraisal install && appraisal rake'
|
24
|
-
end
|
data/bin/setup
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
set -e
|
4
|
-
|
5
|
-
# Install required gems, including Appraisal, which helps us test against
|
6
|
-
# multiple Rails versions
|
7
|
-
gem install bundler --version 1.17.3
|
8
|
-
bundle _1.17.3_ check || bundle _1.17.3_ install
|
9
|
-
|
10
|
-
if [ -z "$CI" ]; then
|
11
|
-
bundle exec appraisal install
|
12
|
-
fi
|
data/gemfiles/rails_4.2.gemfile
DELETED
data/gemfiles/rails_5.0.gemfile
DELETED
data/gemfiles/rails_5.1.gemfile
DELETED
data/gemfiles/rails_5.2.gemfile
DELETED
data/high_voltage.gemspec
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
$:.push File.expand_path("../lib", __FILE__)
|
2
|
-
require "high_voltage/version"
|
3
|
-
|
4
|
-
Gem::Specification.new do |s|
|
5
|
-
s.name = 'high_voltage'
|
6
|
-
s.version = HighVoltage::VERSION.dup
|
7
|
-
s.authors = ['Matt Jankowski', 'Dan Croak', 'Nick Quaranto', 'Chad Pytel', 'Joe Ferris', 'J. Edward Dewyea', 'Tammer Saleh', 'Mike Burns', 'Tristan Dunn']
|
8
|
-
s.email = ['support@thoughtbot.com']
|
9
|
-
s.homepage = 'http://github.com/thoughtbot/high_voltage'
|
10
|
-
s.summary = 'Simple static page rendering controller'
|
11
|
-
s.description = 'Fire in the disco. Fire in the ... taco bell.'
|
12
|
-
s.license = 'MIT'
|
13
|
-
|
14
|
-
s.files = `git ls-files`.split("\n")
|
15
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
-
s.require_paths = ["lib"]
|
18
|
-
|
19
|
-
s.add_development_dependency('activesupport', '>= 3.1.0')
|
20
|
-
s.add_development_dependency('appraisal')
|
21
|
-
s.add_development_dependency('capybara')
|
22
|
-
s.add_development_dependency('pry')
|
23
|
-
s.add_development_dependency('rspec-rails', '~> 3.5')
|
24
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe HighVoltage::Constraints::RootRoute do
|
4
|
-
describe "#matches?" do
|
5
|
-
it "returns true when the view file exists" do
|
6
|
-
request = double(path: "exists")
|
7
|
-
|
8
|
-
result = described_class.new.matches?(request)
|
9
|
-
|
10
|
-
expect(result).to be true
|
11
|
-
end
|
12
|
-
|
13
|
-
it "returns true when the view file exists and url ends with .html" do
|
14
|
-
request = double(path: "exists.html")
|
15
|
-
|
16
|
-
result = described_class.new.matches?(request)
|
17
|
-
|
18
|
-
expect(result).to be true
|
19
|
-
end
|
20
|
-
|
21
|
-
it "returns false when the view files does not exist" do
|
22
|
-
request = double(path: "index")
|
23
|
-
|
24
|
-
result = described_class.new.matches?(request)
|
25
|
-
|
26
|
-
expect(result).to be false
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe AlternativeFinderController do
|
4
|
-
render_views
|
5
|
-
|
6
|
-
it 'renders the file from the alternative directory' do
|
7
|
-
get :show, :id => 'ebg13'
|
8
|
-
|
9
|
-
expect(response).to be_successful
|
10
|
-
expect(response).to render_template('rot13')
|
11
|
-
end
|
12
|
-
end
|
@@ -1,113 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe HighVoltage::PagesController do
|
6
|
-
render_views
|
7
|
-
|
8
|
-
context "using default configuration" do
|
9
|
-
describe "on GET to /pages/exists" do
|
10
|
-
before { get :show, id: "exists" }
|
11
|
-
|
12
|
-
it "responds with success and render template" do
|
13
|
-
expect(response).to be_successful
|
14
|
-
expect(response).to render_template("exists")
|
15
|
-
end
|
16
|
-
|
17
|
-
it "uses the default layout used by ApplicationController" do
|
18
|
-
expect(response).to render_template("layouts/application")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "on GET to /pages/dir/nested" do
|
23
|
-
before { get :show, id: "dir/nested" }
|
24
|
-
|
25
|
-
it "responds with success and render template" do
|
26
|
-
expect(response).to be_successful
|
27
|
-
expect(response).to render_template("pages/dir/nested")
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
it "raises a routing error for an invalid page" do
|
32
|
-
expect { get :show, id: "invalid" }.
|
33
|
-
to raise_error(ActionController::RoutingError)
|
34
|
-
end
|
35
|
-
|
36
|
-
it "raises a routing error for a page in another directory" do
|
37
|
-
expect { get :show, id: "../other/wrong" }.
|
38
|
-
to raise_error(ActionController::RoutingError)
|
39
|
-
end
|
40
|
-
|
41
|
-
it "raises a missing template error for valid page with invalid partial" do
|
42
|
-
expect { get :show, id: "exists_but_references_nonexistent_partial" }.
|
43
|
-
to raise_error(ActionView::MissingTemplate)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context "using custom layout" do
|
48
|
-
before(:each) do
|
49
|
-
HighVoltage.layout = "alternate"
|
50
|
-
end
|
51
|
-
|
52
|
-
describe "on GET to /pages/exists" do
|
53
|
-
before { get :show, id: "exists" }
|
54
|
-
|
55
|
-
it "uses the custom configured layout" do
|
56
|
-
expect(response).not_to render_template("layouts/application")
|
57
|
-
expect(response).to render_template("layouts/alternate")
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
context "using custom content path" do
|
63
|
-
before(:each) do
|
64
|
-
HighVoltage.content_path = "other_pages/"
|
65
|
-
Rails.application.reload_routes!
|
66
|
-
end
|
67
|
-
|
68
|
-
describe "on GET to /other_pages/also_exists" do
|
69
|
-
before { get :show, id: "also_exists" }
|
70
|
-
|
71
|
-
it "responds with success and render template" do
|
72
|
-
expect(response).to be_successful
|
73
|
-
expect(response).to render_template("other_pages/also_exists")
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe "on GET to /other_pages/also_dir/nested" do
|
78
|
-
before { get :show, id: "also_dir/also_nested" }
|
79
|
-
|
80
|
-
it "responds with success and render template" do
|
81
|
-
expect(response).to be_successful
|
82
|
-
expect(response).to render_template("other_pages/also_dir/also_nested")
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
it "raises a routing error for an invalid page" do
|
87
|
-
expect { get :show, id: "also_invalid" }.
|
88
|
-
to raise_error(ActionController::RoutingError)
|
89
|
-
|
90
|
-
expect { get :show, id: "√®ø" }.
|
91
|
-
to raise_error(ActionController::RoutingError)
|
92
|
-
end
|
93
|
-
|
94
|
-
context "page in another directory" do
|
95
|
-
it "raises a routing error" do
|
96
|
-
expect { get :show, id: "../other_wrong" }.
|
97
|
-
to raise_error(ActionController::RoutingError)
|
98
|
-
end
|
99
|
-
|
100
|
-
it "raises a routing error when using a Unicode exploit" do
|
101
|
-
expect { get :show, id: "/\\../other/wrong" }.
|
102
|
-
to raise_error(ActionController::RoutingError)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
it "raises a missing template error for valid page with invalid partial" do
|
107
|
-
id = "also_exists_but_references_nonexistent_partial"
|
108
|
-
|
109
|
-
expect { get :show, id: id }.
|
110
|
-
to raise_error(ActionView::MissingTemplate)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe SubclassedPagesController do
|
4
|
-
render_views
|
5
|
-
|
6
|
-
describe "on GET to /subclassed_pages/also_exists" do
|
7
|
-
before { get :show, id: "also_exists" }
|
8
|
-
|
9
|
-
it "responds with success and render template" do
|
10
|
-
expect(response).to be_successful
|
11
|
-
expect(response).to render_template("also_exists")
|
12
|
-
end
|
13
|
-
|
14
|
-
it "uses the custom configured layout" do
|
15
|
-
expect(response).not_to render_template("layouts/application")
|
16
|
-
expect(response).to render_template("layouts/alternate")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'raises a routing error for an invalid page' do
|
21
|
-
expect { get :show, id: "invalid" }.
|
22
|
-
to raise_error(ActionController::RoutingError)
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'raises a routing error for a page in another directory' do
|
26
|
-
expect { get :show, id: "../other/wrong" }.
|
27
|
-
to raise_error(ActionController::RoutingError)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'raises a missing template error for valid page with invalid partial' do
|
31
|
-
expect { get :show, id: "also_exists_but_references_nonexistent_partial" }.
|
32
|
-
to raise_error(ActionView::MissingTemplate)
|
33
|
-
end
|
34
|
-
end
|
data/spec/fake_app.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
class ApplicationController < ActionController::Base
|
2
|
-
protect_from_forgery
|
3
|
-
end
|
4
|
-
|
5
|
-
# Create a rails app
|
6
|
-
module Dummy
|
7
|
-
class Application < Rails::Application
|
8
|
-
config.secret_key_base = "test"
|
9
|
-
config.eager_load = false
|
10
|
-
config.action_controller.perform_caching = true
|
11
|
-
config.action_controller.cache_store = :memory_store
|
12
|
-
config.root = "spec/fixtures"
|
13
|
-
config.paths["app/views"] << "spec/fixtures/app/views"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
Dummy::Application.initialize!
|
@@ -1 +0,0 @@
|
|
1
|
-
cant get here from pages
|
@@ -1 +0,0 @@
|
|
1
|
-
hello <%= 'world' %> from a nested dir
|
@@ -1 +0,0 @@
|
|
1
|
-
hello <%= 'world' %>
|
@@ -1 +0,0 @@
|
|
1
|
-
partial
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>About Us</h1>
|
@@ -1 +0,0 @@
|
|
1
|
-
hello <%= 'world' %> from a nested dir
|
@@ -1 +0,0 @@
|
|
1
|
-
hello <%= 'world' %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>Current Page: <%= current_page %></h1>
|
@@ -1 +0,0 @@
|
|
1
|
-
hello <%= 'world' %> from a nested dir
|
@@ -1 +0,0 @@
|
|
1
|
-
hello <%= 'world' %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>Exists without html extension</h1>
|
@@ -1 +0,0 @@
|
|
1
|
-
alternative
|
@@ -1 +0,0 @@
|
|
1
|
-
text page
|
File without changes
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'minimal_spec_helper'
|
2
|
-
|
3
|
-
describe HighVoltage::Configuration do
|
4
|
-
describe 'basic config assignment' do
|
5
|
-
let(:config_value) { 'fake_config_value' }
|
6
|
-
|
7
|
-
before(:each) do
|
8
|
-
HighVoltage.configure do |config|
|
9
|
-
ActiveSupport::Deprecation.silence do
|
10
|
-
config.content_path = config_value
|
11
|
-
config.layout = config_value
|
12
|
-
config.parent_engine = config_value
|
13
|
-
config.route_drawer = config_value
|
14
|
-
config.routes = config_value
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
after(:each) do
|
20
|
-
HighVoltage.configure do |config|
|
21
|
-
config.parent_engine = Rails.application
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
it { expect(HighVoltage.content_path).to eq config_value }
|
26
|
-
it { expect(HighVoltage.layout).to eq config_value }
|
27
|
-
it { expect(HighVoltage.parent_engine).to eq config_value }
|
28
|
-
it { expect(HighVoltage.route_drawer).to eq config_value }
|
29
|
-
it { expect(HighVoltage.routes).to eq config_value }
|
30
|
-
end
|
31
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe HighVoltage::PageCollector do
|
4
|
-
it "produces an array of all page_ids under pages/" do
|
5
|
-
expect(HighVoltage.page_ids).to match_array [
|
6
|
-
"about",
|
7
|
-
"also_dir/also_nested",
|
8
|
-
"also_exists",
|
9
|
-
"also_exists_but_references_nonexistent_partial",
|
10
|
-
"current_page_helper",
|
11
|
-
"dir/nested",
|
12
|
-
"exists",
|
13
|
-
"exists_but_references_nonexistent_partial",
|
14
|
-
"rot13",
|
15
|
-
"exists_without_html_extension",
|
16
|
-
"text",
|
17
|
-
]
|
18
|
-
end
|
19
|
-
|
20
|
-
it "produces an array of all page_ids under other_pages/" do
|
21
|
-
with_content_path("other_pages/") do
|
22
|
-
expect(HighVoltage.page_ids).to eq [
|
23
|
-
"also_dir/also_nested",
|
24
|
-
"also_exists",
|
25
|
-
"also_exists_but_references_nonexistent_partial",
|
26
|
-
]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def with_content_path(path)
|
33
|
-
original_content_path = HighVoltage.content_path
|
34
|
-
HighVoltage.content_path = path
|
35
|
-
|
36
|
-
yield
|
37
|
-
|
38
|
-
HighVoltage.content_path = original_content_path
|
39
|
-
end
|
40
|
-
end
|