http-error 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/classifyize-1.0.gem +0 -0
- data/classifyize/LICENSE +8 -0
- data/classifyize/classifyize.gemspec +15 -0
- data/classifyize/lib/classifyize.rb +6 -0
- data/classifyize/lib/cody_robbins/classifyize.rb +7 -0
- data/classifyize/spec/classifyize_spec.rb +7 -0
- data/easier-instance-variable-access-1.0.gem +0 -0
- data/easier-instance-variable-access/LICENSE +8 -0
- data/easier-instance-variable-access/easier-instance-variable-access.gemspec +13 -0
- data/easier-instance-variable-access/lib/cody_robbins/easier_instance_variable_access.rb +18 -0
- data/easier-instance-variable-access/lib/easier-instance-variable-access.rb +3 -0
- data/easier-instance-variable-access/spec/easier_instance_variable_access_spec.rb +44 -0
- data/http-error/Gemfile +4 -0
- data/http-error/Gemfile.lock +86 -0
- data/http-error/LICENSE +8 -0
- data/http-error/README +48 -0
- data/http-error/http-error.gemspec +13 -0
- data/http-error/lib/cody_robbins/http_error/instance_methods.rb +14 -0
- data/http-error/lib/cody_robbins/http_error/railtie.rb +13 -0
- data/http-error/lib/http-error.rb +2 -0
- data/http-error/spec/http_error_spec.rb +28 -0
- data/http-error/spec/spec_helper.rb +17 -0
- data/lookup-record/LICENSE +8 -0
- data/lookup-record/lib/cody_robbins/lookup_record/class_methods.rb +19 -0
- data/lookup-record/lib/cody_robbins/lookup_record/railtie.rb +11 -0
- data/lookup-record/lib/lookup-record.rb +2 -0
- data/lookup-record/lookup-record.gemspec +17 -0
- data/lookup-record/spec/lookup_record_spec.rb +77 -0
- metadata +95 -0
data/classifyize-1.0.gem
ADDED
Binary file
|
data/classifyize/LICENSE
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
The MIT License
|
2
|
+
Copyright © 2011 Cody Robbins
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software“), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
5
|
+
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
7
|
+
|
8
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'classifyize'
|
3
|
+
s.version = '1.0'
|
4
|
+
s.summary = 'Get a class from a symbol or string of its name in one fell swoop'
|
5
|
+
s.homepage = 'http://codyrobbins.com/software/classifyize'
|
6
|
+
s.author = 'Cody Robbins'
|
7
|
+
s.email = 'cody@codyrobbins.com'
|
8
|
+
|
9
|
+
s.post_install_message = 'Please follow me on Twitter!
|
10
|
+
http://twitter.com/codyrobbins'
|
11
|
+
|
12
|
+
s.files = Dir['**/*']
|
13
|
+
|
14
|
+
s.add_dependency('activesupport')
|
15
|
+
end
|
Binary file
|
@@ -0,0 +1,8 @@
|
|
1
|
+
The MIT License
|
2
|
+
Copyright © 2011 Cody Robbins
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software“), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
5
|
+
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
7
|
+
|
8
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'easier-instance-variable-access'
|
3
|
+
s.version = '1.0'
|
4
|
+
s.summary = 'Access instance variables in Ruby the way you should be able to'
|
5
|
+
s.homepage = 'http://codyrobbins.com/software/easier-instance-variable-access'
|
6
|
+
s.author = 'Cody Robbins'
|
7
|
+
s.email = 'cody@codyrobbins.com'
|
8
|
+
|
9
|
+
s.post_install_message = 'Please follow me on Twitter!
|
10
|
+
http://twitter.com/codyrobbins'
|
11
|
+
|
12
|
+
s.files = Dir['**/*']
|
13
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module CodyRobbins
|
2
|
+
module EasierInstanceVariableAccess
|
3
|
+
def get_instance_variable(name)
|
4
|
+
instance_variable_get(instance_variable_name(name))
|
5
|
+
end
|
6
|
+
alias :instance_variable :get_instance_variable
|
7
|
+
|
8
|
+
def set_instance_variable(name, value)
|
9
|
+
instance_variable_set(instance_variable_name(name), value)
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
def instance_variable_name(name)
|
15
|
+
"@#{name}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require('spec_helper')
|
2
|
+
|
3
|
+
describe CodyRobbins::EasierInstanceVariableAccess do
|
4
|
+
class Dummy
|
5
|
+
attr_reader(:variable)
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@variable = 'Value'
|
9
|
+
end
|
10
|
+
|
11
|
+
def get_with_get_instance_variable
|
12
|
+
get_instance_variable(:variable)
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_with_instance_variable
|
16
|
+
instance_variable(:variable)
|
17
|
+
end
|
18
|
+
|
19
|
+
def set(value)
|
20
|
+
set_instance_variable(:variable, value)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
let(:dummy) { Dummy.new }
|
25
|
+
|
26
|
+
describe '#get_instance_variable' do
|
27
|
+
it 'returns the instance variable' do
|
28
|
+
dummy.get_with_get_instance_variable.should == 'Value'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#instance_variable' do
|
33
|
+
it 'returns the instance variable' do
|
34
|
+
dummy.get_with_instance_variable.should == 'Value'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '#set_instance_variable' do
|
39
|
+
it 'sets the instance variable' do
|
40
|
+
dummy.set('New value')
|
41
|
+
dummy.variable.should == 'New value'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/http-error/Gemfile
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
abstract (1.0.0)
|
5
|
+
actionmailer (3.0.5)
|
6
|
+
actionpack (= 3.0.5)
|
7
|
+
mail (~> 2.2.15)
|
8
|
+
actionpack (3.0.5)
|
9
|
+
activemodel (= 3.0.5)
|
10
|
+
activesupport (= 3.0.5)
|
11
|
+
builder (~> 2.1.2)
|
12
|
+
erubis (~> 2.6.6)
|
13
|
+
i18n (~> 0.4)
|
14
|
+
rack (~> 1.2.1)
|
15
|
+
rack-mount (~> 0.6.13)
|
16
|
+
rack-test (~> 0.5.7)
|
17
|
+
tzinfo (~> 0.3.23)
|
18
|
+
activemodel (3.0.5)
|
19
|
+
activesupport (= 3.0.5)
|
20
|
+
builder (~> 2.1.2)
|
21
|
+
i18n (~> 0.4)
|
22
|
+
activerecord (3.0.5)
|
23
|
+
activemodel (= 3.0.5)
|
24
|
+
activesupport (= 3.0.5)
|
25
|
+
arel (~> 2.0.2)
|
26
|
+
tzinfo (~> 0.3.23)
|
27
|
+
activeresource (3.0.5)
|
28
|
+
activemodel (= 3.0.5)
|
29
|
+
activesupport (= 3.0.5)
|
30
|
+
activesupport (3.0.5)
|
31
|
+
arel (2.0.10)
|
32
|
+
builder (2.1.2)
|
33
|
+
diff-lcs (1.1.2)
|
34
|
+
erubis (2.6.6)
|
35
|
+
abstract (>= 1.0.0)
|
36
|
+
i18n (0.5.0)
|
37
|
+
mail (2.2.19)
|
38
|
+
activesupport (>= 2.3.6)
|
39
|
+
i18n (>= 0.4.0)
|
40
|
+
mime-types (~> 1.16)
|
41
|
+
treetop (~> 1.4.8)
|
42
|
+
mime-types (1.16)
|
43
|
+
polyglot (0.3.1)
|
44
|
+
rack (1.2.2)
|
45
|
+
rack-mount (0.6.14)
|
46
|
+
rack (>= 1.0.0)
|
47
|
+
rack-test (0.5.7)
|
48
|
+
rack (>= 1.0)
|
49
|
+
rails (3.0.5)
|
50
|
+
actionmailer (= 3.0.5)
|
51
|
+
actionpack (= 3.0.5)
|
52
|
+
activerecord (= 3.0.5)
|
53
|
+
activeresource (= 3.0.5)
|
54
|
+
activesupport (= 3.0.5)
|
55
|
+
bundler (~> 1.0)
|
56
|
+
railties (= 3.0.5)
|
57
|
+
railties (3.0.5)
|
58
|
+
actionpack (= 3.0.5)
|
59
|
+
activesupport (= 3.0.5)
|
60
|
+
rake (>= 0.8.7)
|
61
|
+
thor (~> 0.14.4)
|
62
|
+
rake (0.9.0)
|
63
|
+
rspec (2.6.0)
|
64
|
+
rspec-core (~> 2.6.0)
|
65
|
+
rspec-expectations (~> 2.6.0)
|
66
|
+
rspec-mocks (~> 2.6.0)
|
67
|
+
rspec-core (2.6.1)
|
68
|
+
rspec-expectations (2.6.0)
|
69
|
+
diff-lcs (~> 1.1.2)
|
70
|
+
rspec-mocks (2.6.0)
|
71
|
+
rspec-rails (2.6.0)
|
72
|
+
actionpack (~> 3.0)
|
73
|
+
activesupport (~> 3.0)
|
74
|
+
railties (~> 3.0)
|
75
|
+
rspec (~> 2.6.0)
|
76
|
+
thor (0.14.6)
|
77
|
+
treetop (1.4.9)
|
78
|
+
polyglot (>= 0.3.1)
|
79
|
+
tzinfo (0.3.27)
|
80
|
+
|
81
|
+
PLATFORMS
|
82
|
+
ruby
|
83
|
+
|
84
|
+
DEPENDENCIES
|
85
|
+
rails (= 3.0.5)
|
86
|
+
rspec-rails
|
data/http-error/LICENSE
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
The MIT License
|
2
|
+
Copyright © 2011 Cody Robbins
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software“), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
5
|
+
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
7
|
+
|
8
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/http-error/README
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
HTTP Error for Rails
|
2
|
+
====================
|
3
|
+
|
4
|
+
This Rails plugin is great! It makes an `http_error` method available in `ApplicationController` which
|
5
|
+
|
6
|
+
* always returns the specified HTTP error code in the response (always!),
|
7
|
+
* renders with aplomb the corresponding HTML error document in `public`, and
|
8
|
+
* cheerfully returns `false`.
|
9
|
+
|
10
|
+
An important feature is that the cheerfulness with which `http-error` returns `false` will surely brighten your day. Returning `false` also allows you to use `http_error` at the end of a `before_filter` to halt the filter chain. While halting a filter chain has some weighty moral and ethical implications—and I myself am a stauch proponent of the self-determination of filter chains—I have to take the pro-choice stance on this issue and admit that it is everyone's prerogative to terminate their own filter chains if they so choose.
|
11
|
+
|
12
|
+
Examples
|
13
|
+
--------
|
14
|
+
|
15
|
+
class xfeOIh8<ApplicationController;before_filter(:oaoh8r_o823y);end
|
16
|
+
|
17
|
+
Haha, just kidding—this isn't Java, after all!
|
18
|
+
|
19
|
+
class UserController < ApplicationController
|
20
|
+
before_filter(:get_user, :before => :show)
|
21
|
+
|
22
|
+
def delete
|
23
|
+
@user.destroy!
|
24
|
+
end
|
25
|
+
|
26
|
+
protected
|
27
|
+
|
28
|
+
def get_user
|
29
|
+
@user = User.find_by_id(params[:user])
|
30
|
+
http_error(404) unless @user
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
Tested with
|
35
|
+
-----------
|
36
|
+
|
37
|
+
* Rails 3.0.5 — 20 May 2011.
|
38
|
+
|
39
|
+
Y2K-Compliance
|
40
|
+
--------------
|
41
|
+
|
42
|
+
This gem is Y2K-compliant.
|
43
|
+
|
44
|
+
Credits
|
45
|
+
------
|
46
|
+
|
47
|
+
* Programming: Cody Robbins
|
48
|
+
* Translation: Ted Woolsey
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'http-error'
|
3
|
+
s.version = '1.0'
|
4
|
+
s.summary = 'Return HTTP error codes while rendering the corresponding error page in Rails'
|
5
|
+
s.homepage = 'http://codyrobbins.com/software/http-error'
|
6
|
+
s.author = 'Cody Robbins'
|
7
|
+
s.email = 'cody@codyrobbins.com'
|
8
|
+
|
9
|
+
s.post_install_message = 'Please follow me on Twitter!
|
10
|
+
http://twitter.com/codyrobbins'
|
11
|
+
|
12
|
+
s.files = Dir['**/*']
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require('rails')
|
2
|
+
|
3
|
+
module CodyRobbins
|
4
|
+
module HttpError
|
5
|
+
class Railtie < Rails::Railtie
|
6
|
+
initializer('cody_robbins.http_error') do
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
ApplicationController.send(:include, InstanceMethods)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require('spec_helper')
|
2
|
+
|
3
|
+
describe CodyRobbins::HttpError, :type => :controller do
|
4
|
+
controller do
|
5
|
+
def index
|
6
|
+
@result = http_error(404)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#http_error' do
|
11
|
+
before { get(:index) }
|
12
|
+
|
13
|
+
it 'responds with the correct status code' do
|
14
|
+
response.code.should == '404'
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'renders the error document' do
|
18
|
+
path = File.join(Rails.root, 'public', '404.html')
|
19
|
+
page = File.open(path).read
|
20
|
+
|
21
|
+
response.body.should == page
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'returns false' do
|
25
|
+
assigns(:result).should be_false
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
ENV["RAILS_ENV"] ||= 'test'
|
2
|
+
|
3
|
+
# Testing apparatus.
|
4
|
+
require('action_controller')
|
5
|
+
require('action_dispatch')
|
6
|
+
require('rspec/rails')
|
7
|
+
|
8
|
+
# Load the gem.
|
9
|
+
require('http-error')
|
10
|
+
|
11
|
+
# We need an empty application and controller for rspec-rails to do its job.
|
12
|
+
class Application < Rails::Application; end
|
13
|
+
class ApplicationController < ActionController::Base; end
|
14
|
+
|
15
|
+
# We also need some default routes.
|
16
|
+
# http://stackoverflow.com/questions/5970811/whats-the-proper-way-to-mock-rails-3-routes-and-controllers-in-a-plugin-test
|
17
|
+
Application.routes.draw do; end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
The MIT License
|
2
|
+
Copyright © 2011 Cody Robbins
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software“), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
5
|
+
|
6
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
7
|
+
|
8
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module CodyRobbins
|
2
|
+
module LookupRecord
|
3
|
+
module ClassMethods
|
4
|
+
def lookup_record(name, filter_options = {})
|
5
|
+
before_filter(filter_options) do
|
6
|
+
model = name.classifyize
|
7
|
+
id = params[:id] || params[name]
|
8
|
+
object = model.find_by_id(id)
|
9
|
+
|
10
|
+
if object
|
11
|
+
set_instance_variable(name, object)
|
12
|
+
else
|
13
|
+
http_error(404)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'lookup-record'
|
3
|
+
s.version = '1.0'
|
4
|
+
s.summary = 'Find records for Rails controller actions declaratively'
|
5
|
+
s.homepage = 'http://codyrobbins.com/software/lookup-record'
|
6
|
+
s.author = 'Cody Robbins'
|
7
|
+
s.email = 'cody@codyrobbins.com'
|
8
|
+
|
9
|
+
s.post_install_message = 'Please follow me on Twitter!
|
10
|
+
http://twitter.com/codyrobbins'
|
11
|
+
|
12
|
+
s.files = Dir['**/*']
|
13
|
+
|
14
|
+
s.add_dependency('easiser-instance-variable-access')
|
15
|
+
s.add_dependency('classifyize')
|
16
|
+
s.add_dependency('http-error')
|
17
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require('spec_helper')
|
2
|
+
|
3
|
+
describe CodyRobbins::LookupRecord, :type => :controller do
|
4
|
+
before { there_is_a_user }
|
5
|
+
|
6
|
+
describe '#lookup_record' do
|
7
|
+
shared_examples_for 'Successful lookup' do
|
8
|
+
it 'sets the instance variable' do
|
9
|
+
assigns(:user).should == user
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'executes the action' do
|
13
|
+
response.body.should == 'Success'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
controller do
|
18
|
+
lookup_record(:user)
|
19
|
+
|
20
|
+
def index
|
21
|
+
@executed = true
|
22
|
+
render(:text => 'Success')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe 'Existing record' do
|
27
|
+
before { get(:index, :id => user) }
|
28
|
+
it_should_behave_like 'Successful lookup'
|
29
|
+
end
|
30
|
+
|
31
|
+
describe 'Non-existent record' do
|
32
|
+
before do
|
33
|
+
get(:index, :id => 'X')
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'does not set the instance variable' do
|
37
|
+
assigns(:user).should be_nil
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'does not execute the action' do
|
41
|
+
assigns(:executed).should be_nil
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'responds with a 404' do
|
45
|
+
response.code.should == '404'
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'renders the 404 page' do
|
49
|
+
path = File.join(Rails.root, 'public', '404.html')
|
50
|
+
page = File.open(path).read
|
51
|
+
|
52
|
+
response.body.should == page
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe 'Using the model name as the parameter' do
|
57
|
+
before { get(:index, :user => user) }
|
58
|
+
it_should_behave_like 'Successful lookup'
|
59
|
+
end
|
60
|
+
|
61
|
+
describe 'Filter options' do
|
62
|
+
controller do
|
63
|
+
lookup_record(:user, :except => :index)
|
64
|
+
|
65
|
+
def index
|
66
|
+
@executed = true
|
67
|
+
render(:text => 'Success')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should not set the instance variable' do
|
72
|
+
get(:index, :id => user)
|
73
|
+
assigns(:user).should be_nil
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: http-error
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 15
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: "1.0"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Cody Robbins
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-05-20 00:00:00 -04:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description:
|
22
|
+
email: cody@codyrobbins.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files: []
|
28
|
+
|
29
|
+
files:
|
30
|
+
- classifyize/classifyize.gemspec
|
31
|
+
- classifyize/lib/classifyize.rb
|
32
|
+
- classifyize/lib/cody_robbins/classifyize.rb
|
33
|
+
- classifyize/LICENSE
|
34
|
+
- classifyize/spec/classifyize_spec.rb
|
35
|
+
- classifyize-1.0.gem
|
36
|
+
- easier-instance-variable-access/easier-instance-variable-access.gemspec
|
37
|
+
- easier-instance-variable-access/lib/cody_robbins/easier_instance_variable_access.rb
|
38
|
+
- easier-instance-variable-access/lib/easier-instance-variable-access.rb
|
39
|
+
- easier-instance-variable-access/LICENSE
|
40
|
+
- easier-instance-variable-access/spec/easier_instance_variable_access_spec.rb
|
41
|
+
- easier-instance-variable-access-1.0.gem
|
42
|
+
- http-error/Gemfile
|
43
|
+
- http-error/Gemfile.lock
|
44
|
+
- http-error/http-error.gemspec
|
45
|
+
- http-error/lib/cody_robbins/http_error/instance_methods.rb
|
46
|
+
- http-error/lib/cody_robbins/http_error/railtie.rb
|
47
|
+
- http-error/lib/http-error.rb
|
48
|
+
- http-error/LICENSE
|
49
|
+
- http-error/README
|
50
|
+
- http-error/spec/http_error_spec.rb
|
51
|
+
- http-error/spec/spec_helper.rb
|
52
|
+
- lookup-record/lib/cody_robbins/lookup_record/class_methods.rb
|
53
|
+
- lookup-record/lib/cody_robbins/lookup_record/railtie.rb
|
54
|
+
- lookup-record/lib/lookup-record.rb
|
55
|
+
- lookup-record/LICENSE
|
56
|
+
- lookup-record/lookup-record.gemspec
|
57
|
+
- lookup-record/spec/lookup_record_spec.rb
|
58
|
+
has_rdoc: true
|
59
|
+
homepage: http://codyrobbins.com/software/http-error
|
60
|
+
licenses: []
|
61
|
+
|
62
|
+
post_install_message: |-
|
63
|
+
Please follow me on Twitter!
|
64
|
+
http://twitter.com/codyrobbins
|
65
|
+
rdoc_options: []
|
66
|
+
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
hash: 3
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
version: "0"
|
87
|
+
requirements: []
|
88
|
+
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 1.3.7
|
91
|
+
signing_key:
|
92
|
+
specification_version: 3
|
93
|
+
summary: Return HTTP error codes while rendering the corresponding error page in Rails
|
94
|
+
test_files: []
|
95
|
+
|