high_voltage 1.0.1 → 1.2.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 +9 -0
- data/.travis.yml +9 -0
- data/Appraisals +5 -0
- data/CONTRIBUTING.md +38 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +94 -0
- data/README.md +11 -1
- data/Rakefile +18 -0
- data/app/controllers/high_voltage/pages_controller.rb +12 -3
- data/config/routes.rb +2 -1
- data/gemfiles/rails-3.0.15.gemfile +7 -0
- data/gemfiles/rails-3.1.6.gemfile +7 -0
- data/gemfiles/rails-3.2.6.gemfile +7 -0
- data/high_voltage.gemspec +22 -0
- data/lib/high_voltage/version.rb +3 -0
- data/lib/high_voltage.rb +12 -0
- data/spec/controllers/pages_controller_spec.rb +112 -0
- data/spec/controllers/subclassed_pages_controller_spec.rb +41 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/subclassed_pages_controller.rb +7 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/alternate.html.erb +14 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/other/wrong.html.erb +1 -0
- data/spec/dummy/app/views/other_pages/also_dir/also_nested.html.erb +1 -0
- data/spec/dummy/app/views/other_pages/also_exists.html.erb +1 -0
- data/spec/dummy/app/views/other_pages/also_exists_but_references_nonexistent_partial.html.erb +2 -0
- data/spec/dummy/app/views/pages/dir/nested.html.erb +1 -0
- data/spec/dummy/app/views/pages/exists.html.erb +1 -0
- data/spec/dummy/app/views/pages/exists_but_references_nonexistent_partial.html.erb +2 -0
- data/spec/dummy/config/application.rb +44 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +25 -0
- data/spec/dummy/config/environments/production.rb +49 -0
- data/spec/dummy/config/environments/test.rb +35 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/javascripts/application.js +2 -0
- data/spec/dummy/public/javascripts/controls.js +965 -0
- data/spec/dummy/public/javascripts/dragdrop.js +974 -0
- data/spec/dummy/public/javascripts/effects.js +1123 -0
- data/spec/dummy/public/javascripts/prototype.js +6001 -0
- data/spec/dummy/public/javascripts/rails.js +191 -0
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/high_voltage_spec.rb +7 -0
- data/spec/integration/navigation_spec.rb +9 -0
- data/spec/routing/routes_spec.rb +68 -0
- data/spec/spec_helper.rb +30 -0
- metadata +134 -6
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Appraisals
ADDED
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
We love pull requests. Here's a quick guide:
|
|
2
|
+
|
|
3
|
+
1. Fork the repo.
|
|
4
|
+
|
|
5
|
+
2. Run the tests. We only take pull requests with passing tests, and it's great
|
|
6
|
+
to know that you have a clean slate: `bundle && rake`
|
|
7
|
+
|
|
8
|
+
3. Add a test for your change. Only refactoring and documentation changes
|
|
9
|
+
require no new tests. If you are adding functionality or fixing a bug, we need
|
|
10
|
+
a test!
|
|
11
|
+
|
|
12
|
+
4. Make the test pass.
|
|
13
|
+
|
|
14
|
+
5. Push to your fork and submit a pull request.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
At this point you're waiting on us. We like to at least comment on, if not
|
|
18
|
+
accept, pull requests within three business days (and, typically, one business
|
|
19
|
+
day). We may suggest some changes or improvements or alternatives.
|
|
20
|
+
|
|
21
|
+
Some things that will increase the chance that your pull request is accepted,
|
|
22
|
+
taken straight from the Ruby on Rails guide:
|
|
23
|
+
|
|
24
|
+
* Use Rails idioms and helpers
|
|
25
|
+
* Include tests that fail without your code, and pass with it
|
|
26
|
+
* Update the documentation, the surrounding one, examples elsewhere, guides,
|
|
27
|
+
whatever is affected by your contribution
|
|
28
|
+
|
|
29
|
+
Syntax:
|
|
30
|
+
|
|
31
|
+
* Two spaces, no tabs.
|
|
32
|
+
* No trailing whitespace. Blank lines should not have any space.
|
|
33
|
+
* Prefer &&/|| over and/or.
|
|
34
|
+
* MyClass.my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
|
35
|
+
* a = b and not a=b.
|
|
36
|
+
* Follow the conventions you see used in the source already.
|
|
37
|
+
|
|
38
|
+
And in case we didn't emphasize it enough: we love tests!
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
high_voltage (1.2.0)
|
|
5
|
+
|
|
6
|
+
GEM
|
|
7
|
+
remote: http://rubygems.org/
|
|
8
|
+
specs:
|
|
9
|
+
abstract (1.0.0)
|
|
10
|
+
actionpack (3.0.10)
|
|
11
|
+
activemodel (= 3.0.10)
|
|
12
|
+
activesupport (= 3.0.10)
|
|
13
|
+
builder (~> 2.1.2)
|
|
14
|
+
erubis (~> 2.6.6)
|
|
15
|
+
i18n (~> 0.5.0)
|
|
16
|
+
rack (~> 1.2.1)
|
|
17
|
+
rack-mount (~> 0.6.14)
|
|
18
|
+
rack-test (~> 0.5.7)
|
|
19
|
+
tzinfo (~> 0.3.23)
|
|
20
|
+
activemodel (3.0.10)
|
|
21
|
+
activesupport (= 3.0.10)
|
|
22
|
+
builder (~> 2.1.2)
|
|
23
|
+
i18n (~> 0.5.0)
|
|
24
|
+
activesupport (3.0.10)
|
|
25
|
+
appraisal (0.4.1)
|
|
26
|
+
bundler
|
|
27
|
+
rake
|
|
28
|
+
builder (2.1.2)
|
|
29
|
+
capybara (1.1.0)
|
|
30
|
+
mime-types (>= 1.16)
|
|
31
|
+
nokogiri (>= 1.3.3)
|
|
32
|
+
rack (>= 1.0.0)
|
|
33
|
+
rack-test (>= 0.5.4)
|
|
34
|
+
selenium-webdriver (~> 2.0)
|
|
35
|
+
xpath (~> 0.1.4)
|
|
36
|
+
childprocess (0.2.2)
|
|
37
|
+
ffi (~> 1.0.6)
|
|
38
|
+
diff-lcs (1.1.3)
|
|
39
|
+
erubis (2.6.6)
|
|
40
|
+
abstract (>= 1.0.0)
|
|
41
|
+
ffi (1.0.9)
|
|
42
|
+
i18n (0.5.0)
|
|
43
|
+
json_pure (1.5.4)
|
|
44
|
+
spruz (~> 0.2.8)
|
|
45
|
+
mime-types (1.16)
|
|
46
|
+
nokogiri (1.5.0)
|
|
47
|
+
rack (1.2.3)
|
|
48
|
+
rack-mount (0.6.14)
|
|
49
|
+
rack (>= 1.0.0)
|
|
50
|
+
rack-test (0.5.7)
|
|
51
|
+
rack (>= 1.0)
|
|
52
|
+
railties (3.0.10)
|
|
53
|
+
actionpack (= 3.0.10)
|
|
54
|
+
activesupport (= 3.0.10)
|
|
55
|
+
rake (>= 0.8.7)
|
|
56
|
+
rdoc (~> 3.4)
|
|
57
|
+
thor (~> 0.14.4)
|
|
58
|
+
rake (0.9.2.2)
|
|
59
|
+
rdoc (3.9.4)
|
|
60
|
+
rspec (2.6.0)
|
|
61
|
+
rspec-core (~> 2.6.0)
|
|
62
|
+
rspec-expectations (~> 2.6.0)
|
|
63
|
+
rspec-mocks (~> 2.6.0)
|
|
64
|
+
rspec-core (2.6.4)
|
|
65
|
+
rspec-expectations (2.6.0)
|
|
66
|
+
diff-lcs (~> 1.1.2)
|
|
67
|
+
rspec-mocks (2.6.0)
|
|
68
|
+
rspec-rails (2.6.1)
|
|
69
|
+
actionpack (~> 3.0)
|
|
70
|
+
activesupport (~> 3.0)
|
|
71
|
+
railties (~> 3.0)
|
|
72
|
+
rspec (~> 2.6.0)
|
|
73
|
+
rubyzip (0.9.4)
|
|
74
|
+
selenium-webdriver (2.5.0)
|
|
75
|
+
childprocess (>= 0.2.1)
|
|
76
|
+
ffi (>= 1.0.7)
|
|
77
|
+
json_pure
|
|
78
|
+
rubyzip
|
|
79
|
+
spruz (0.2.13)
|
|
80
|
+
sqlite3 (1.3.4)
|
|
81
|
+
thor (0.14.6)
|
|
82
|
+
tzinfo (0.3.29)
|
|
83
|
+
xpath (0.1.4)
|
|
84
|
+
nokogiri (~> 1.3)
|
|
85
|
+
|
|
86
|
+
PLATFORMS
|
|
87
|
+
ruby
|
|
88
|
+
|
|
89
|
+
DEPENDENCIES
|
|
90
|
+
appraisal
|
|
91
|
+
capybara (>= 0.4.0)
|
|
92
|
+
high_voltage!
|
|
93
|
+
rspec-rails
|
|
94
|
+
sqlite3
|
data/README.md
CHANGED
|
@@ -71,6 +71,15 @@ You can route the root url to a high voltage page like this:
|
|
|
71
71
|
|
|
72
72
|
Which will render a homepage from app/views/pages/home.html.erb
|
|
73
73
|
|
|
74
|
+
Customize
|
|
75
|
+
--------
|
|
76
|
+
|
|
77
|
+
High Voltage uses a default path and folder of 'pages', i.e. 'url.com/pages/contact' , 'app/views/pages'
|
|
78
|
+
|
|
79
|
+
You can change this in an initializer:
|
|
80
|
+
|
|
81
|
+
HighVoltage.content_path = "site/"
|
|
82
|
+
|
|
74
83
|
Override
|
|
75
84
|
--------
|
|
76
85
|
|
|
@@ -78,6 +87,7 @@ Most common reasons to override?
|
|
|
78
87
|
|
|
79
88
|
* You need authentication around the pages to make sure a user is signed in.
|
|
80
89
|
* You need to render different layouts for different pages.
|
|
90
|
+
* You need to render a partial from the `app/views/pages` directory.
|
|
81
91
|
|
|
82
92
|
Create a PagesController of your own:
|
|
83
93
|
|
|
@@ -86,7 +96,7 @@ Create a PagesController of your own:
|
|
|
86
96
|
Override the default route:
|
|
87
97
|
|
|
88
98
|
# in config/routes.rb
|
|
89
|
-
|
|
99
|
+
match "/pages/*id" => 'pages#show', :as => :page, :format => false
|
|
90
100
|
|
|
91
101
|
Then modify it to subclass from High Voltage, adding whatever you need:
|
|
92
102
|
|
data/Rakefile
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'bundler/setup'
|
|
2
|
+
require 'bundler/gem_tasks'
|
|
3
|
+
require 'appraisal'
|
|
4
|
+
|
|
5
|
+
require 'rspec/core/rake_task'
|
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
7
|
+
|
|
8
|
+
task :default do |t|
|
|
9
|
+
if ENV['BUNDLE_GEMFILE'] =~ /gemfiles/
|
|
10
|
+
exec 'rake spec'
|
|
11
|
+
else
|
|
12
|
+
Rake::Task['appraise'].execute
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
task :appraise => ['appraisal:install'] do |t|
|
|
17
|
+
exec 'rake appraisal'
|
|
18
|
+
end
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
class HighVoltage::PagesController < ApplicationController
|
|
2
|
+
VALID_CHARACTERS = "a-zA-Z0-9~!@$%^&*()#`_+-=<>\"{}|[];',?".freeze
|
|
2
3
|
|
|
3
4
|
unloadable
|
|
5
|
+
layout Proc.new { |_| HighVoltage.layout }
|
|
4
6
|
|
|
5
7
|
rescue_from ActionView::MissingTemplate do |exception|
|
|
6
|
-
if exception.message =~ %r{Missing template
|
|
8
|
+
if exception.message =~ %r{Missing template #{content_path}}
|
|
7
9
|
raise ActionController::RoutingError, "No such page: #{params[:id]}"
|
|
8
10
|
else
|
|
9
11
|
raise exception
|
|
@@ -17,12 +19,19 @@ class HighVoltage::PagesController < ApplicationController
|
|
|
17
19
|
protected
|
|
18
20
|
|
|
19
21
|
def current_page
|
|
20
|
-
"
|
|
22
|
+
"#{content_path}#{clean_path}"
|
|
21
23
|
end
|
|
22
24
|
|
|
23
25
|
def clean_path
|
|
24
|
-
path = Pathname.new
|
|
26
|
+
path = Pathname.new("/#{clean_id}")
|
|
25
27
|
path.cleanpath.to_s[1..-1]
|
|
26
28
|
end
|
|
27
29
|
|
|
30
|
+
def content_path
|
|
31
|
+
HighVoltage.content_path
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def clean_id
|
|
35
|
+
params[:id].tr("^#{VALID_CHARACTERS}", '')
|
|
36
|
+
end
|
|
28
37
|
end
|
data/config/routes.rb
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
|
|
13
|
+
s.files = `git ls-files`.split("\n")
|
|
14
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
15
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
16
|
+
s.require_paths = ["lib"]
|
|
17
|
+
|
|
18
|
+
s.add_development_dependency("appraisal")
|
|
19
|
+
s.add_development_dependency("rspec-rails")
|
|
20
|
+
s.add_development_dependency("capybara", ">= 0.4.0")
|
|
21
|
+
s.add_development_dependency("sqlite3")
|
|
22
|
+
end
|
data/lib/high_voltage.rb
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
require 'high_voltage/version'
|
|
2
|
+
|
|
1
3
|
module HighVoltage
|
|
4
|
+
mattr_accessor :layout
|
|
5
|
+
@@layout = "application"
|
|
6
|
+
|
|
7
|
+
mattr_accessor :content_path
|
|
8
|
+
@@content_path = "pages/"
|
|
9
|
+
|
|
10
|
+
def self.setup
|
|
11
|
+
yield self
|
|
12
|
+
end
|
|
13
|
+
|
|
2
14
|
require 'high_voltage/engine' if defined?(Rails)
|
|
3
15
|
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe HighVoltage::PagesController do
|
|
6
|
+
|
|
7
|
+
render_views
|
|
8
|
+
|
|
9
|
+
context "using default configuration" do
|
|
10
|
+
|
|
11
|
+
describe "on GET to /pages/exists" do
|
|
12
|
+
before { get :show, :id => 'exists' }
|
|
13
|
+
|
|
14
|
+
it "should respond with success and render template" do
|
|
15
|
+
response.should be_success
|
|
16
|
+
response.should render_template('exists')
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "should use the default layout used by ApplicationController" do
|
|
20
|
+
response.should render_template("layouts/application")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe "on GET to /pages/dir/nested" do
|
|
25
|
+
before { get :show, :id => 'dir/nested' }
|
|
26
|
+
|
|
27
|
+
it "should respond with success and render template" do
|
|
28
|
+
response.should be_success
|
|
29
|
+
response.should render_template('pages/dir/nested')
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "should raise a routing error for an invalid page" do
|
|
34
|
+
lambda { get :show, :id => "invalid" }.should raise_error(ActionController::RoutingError)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "should raise a routing error for a page in another directory" do
|
|
38
|
+
lambda { get :show, :id => "../other/wrong" }.should raise_error(ActionController::RoutingError)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "should raise missing template error for valid page with invalid partial" do
|
|
42
|
+
lambda { get :show, :id => "exists_but_references_nonexistent_partial" }.should raise_error(ActionView::MissingTemplate)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
context "using custom layout" do
|
|
47
|
+
before(:all) do
|
|
48
|
+
@original_layout = HighVoltage.layout
|
|
49
|
+
HighVoltage.layout = "alternate"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
after(:all) do
|
|
53
|
+
HighVoltage.layout = @original_layout
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
describe "on GET to /pages/exists" do
|
|
57
|
+
before { get :show, :id => "exists" }
|
|
58
|
+
|
|
59
|
+
it "should use the custom configured layout" do
|
|
60
|
+
response.should_not render_template("layouts/application")
|
|
61
|
+
response.should render_template("layouts/alternate")
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
context "using custom content path" do
|
|
67
|
+
before(:all) do
|
|
68
|
+
@original_content_path = HighVoltage.content_path
|
|
69
|
+
HighVoltage.content_path = "other_pages/"
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
after(:all) do
|
|
73
|
+
HighVoltage.content_path = @original_content_path
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
describe "on GET to /other_pages/also_exists" do
|
|
77
|
+
before { get :show, :id => 'also_exists' }
|
|
78
|
+
|
|
79
|
+
it "should respond with success and render template" do
|
|
80
|
+
response.should be_success
|
|
81
|
+
response.should render_template('other_pages/also_exists')
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
describe "on GET to /other_pages/also_dir/nested" do
|
|
86
|
+
before { get :show, :id => 'also_dir/also_nested' }
|
|
87
|
+
|
|
88
|
+
it "should respond with success and render template" do
|
|
89
|
+
response.should be_success
|
|
90
|
+
response.should render_template('other_pages/also_dir/also_nested')
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
it "should raise a routing error for an invalid page" do
|
|
95
|
+
lambda { get :show, :id => "also_invalid" }.should raise_error(ActionController::RoutingError)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it "should raise a routing error for a page in another directory" do
|
|
99
|
+
lambda { get :show, :id => "../other/wrong" }.should raise_error(ActionController::RoutingError)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
it "should raise a routing error for a page in another directory when using a Unicode exploit" do
|
|
103
|
+
lambda { get :show, :id => "/\\../other/wrong" }.should raise_error(ActionController::RoutingError)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
it "should raise missing template error for valid page with invalid partial" do
|
|
107
|
+
lambda { get :show, :id => "also_exists_but_references_nonexistent_partial" }.should raise_error(ActionView::MissingTemplate)
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe SubclassedPagesController do
|
|
4
|
+
|
|
5
|
+
render_views
|
|
6
|
+
|
|
7
|
+
describe "on GET to /subclassed_pages/also_exists" do
|
|
8
|
+
before { get :show, :id => 'also_exists' }
|
|
9
|
+
|
|
10
|
+
it "should respond with success and render template" do
|
|
11
|
+
response.should be_success
|
|
12
|
+
response.should render_template('also_exists')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "should use the custom configured layout" do
|
|
16
|
+
response.should_not render_template("layouts/application")
|
|
17
|
+
response.should render_template('layouts/alternate')
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe "on GET to /subclassed_pages/also_dir/nested" do
|
|
22
|
+
before { get :show, :id => 'also_dir/also_nested' }
|
|
23
|
+
|
|
24
|
+
it "should respond with success and render template" do
|
|
25
|
+
response.should be_success
|
|
26
|
+
response.should render_template('other_pages/also_dir/also_nested')
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should raise a routing error for an invalid page" do
|
|
31
|
+
lambda { get :show, :id => "invalid" }.should raise_error(ActionController::RoutingError)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should raise a routing error for a page in another directory" do
|
|
35
|
+
lambda { get :show, :id => "../other/wrong" }.should raise_error(ActionController::RoutingError)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should raise missing template error for valid page with invalid partial" do
|
|
39
|
+
lambda { get :show, :id => "also_exists_but_references_nonexistent_partial" }.should raise_error(ActionView::MissingTemplate)
|
|
40
|
+
end
|
|
41
|
+
end
|
data/spec/dummy/Rakefile
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
|
3
|
+
|
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
|
5
|
+
require 'rake'
|
|
6
|
+
|
|
7
|
+
Dummy::Application.load_tasks
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cant get here from pages
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hello <%= 'world' %> from a nested dir
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hello <%= 'world' %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hello <%= 'world' %> from a nested dir
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hello <%= 'world' %>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
|
2
|
+
|
|
3
|
+
require "active_model/railtie"
|
|
4
|
+
require "action_controller/railtie"
|
|
5
|
+
require "action_view/railtie"
|
|
6
|
+
require "action_mailer/railtie"
|
|
7
|
+
|
|
8
|
+
Bundler.require
|
|
9
|
+
require "high_voltage"
|
|
10
|
+
|
|
11
|
+
module Dummy
|
|
12
|
+
class Application < Rails::Application
|
|
13
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
14
|
+
# Application configuration should go into files in config/initializers
|
|
15
|
+
# -- all .rb files in that directory are automatically loaded.
|
|
16
|
+
|
|
17
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
|
18
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
|
19
|
+
|
|
20
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
|
21
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
|
22
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
|
23
|
+
|
|
24
|
+
# Activate observers that should always be running.
|
|
25
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
|
26
|
+
|
|
27
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
28
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
29
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
|
30
|
+
|
|
31
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
32
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
33
|
+
# config.i18n.default_locale = :de
|
|
34
|
+
|
|
35
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
|
36
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
|
37
|
+
|
|
38
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
|
39
|
+
config.encoding = "utf-8"
|
|
40
|
+
|
|
41
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
|
42
|
+
config.filter_parameters += [:password]
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Dummy::Application.configure do
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
|
3
|
+
|
|
4
|
+
# In the development environment your application's code is reloaded on
|
|
5
|
+
# every request. This slows down response time but is perfect for development
|
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
|
7
|
+
config.cache_classes = false
|
|
8
|
+
|
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
|
10
|
+
config.whiny_nils = true
|
|
11
|
+
|
|
12
|
+
# Show full error reports and disable caching
|
|
13
|
+
config.consider_all_requests_local = true
|
|
14
|
+
config.action_controller.perform_caching = false
|
|
15
|
+
|
|
16
|
+
# Don't care if the mailer can't send
|
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
|
18
|
+
|
|
19
|
+
# Print deprecation notices to the Rails logger
|
|
20
|
+
config.active_support.deprecation = :log
|
|
21
|
+
|
|
22
|
+
# Only use best-standards-support built into browsers
|
|
23
|
+
config.action_dispatch.best_standards_support = :builtin
|
|
24
|
+
end
|
|
25
|
+
|