webget-action_controller_mock 1.0.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/lib/action_controller_mock.rb +35 -0
- data/test/unit/action_controller_mock_test.rb +28 -0
- metadata +53 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
# = ActionController::Base Mock
|
2
|
+
#
|
3
|
+
# Author:: Joel Parker Henderson, joelparkerhenderson@gmail.com
|
4
|
+
# Copyright:: Copyright (c) 2006-2008 Joel Parker Henderson
|
5
|
+
# License:: CreativeCommons License, Non-commercial Share Alike
|
6
|
+
# License:: LGPL, GNU Lesser General Public License
|
7
|
+
#
|
8
|
+
##
|
9
|
+
|
10
|
+
module ActionController
|
11
|
+
|
12
|
+
class Base
|
13
|
+
|
14
|
+
RAILS_ROOT=''
|
15
|
+
|
16
|
+
attr_accessor :filter_chain
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@filter_chain=[]
|
20
|
+
end
|
21
|
+
|
22
|
+
def append_before_filter(*filters,&b)
|
23
|
+
@filter_chain += [*filters]
|
24
|
+
end
|
25
|
+
|
26
|
+
def append_after_filter(filters,&b)
|
27
|
+
@filter_chain += [*filters]
|
28
|
+
end
|
29
|
+
|
30
|
+
alias_method :before_filter, :append_before_filter
|
31
|
+
alias_method :after_filter, :append_after_filter
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'action_controller_mock'
|
3
|
+
|
4
|
+
class ActionControllerMockTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@mock=ActionController::Base.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_rails_root_constant
|
11
|
+
assert_equal('',ActionController::Base::RAILS_ROOT,"mock rails root")
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_filter_chain_empty
|
15
|
+
assert_equal([],@mock.filter_chain)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_before_filter
|
19
|
+
@mock.before_filter(:foo)
|
20
|
+
assert_equal([:foo],@mock.filter_chain)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_after_filter
|
24
|
+
@mock.after_filter(:foo)
|
25
|
+
assert_equal([:foo],@mock.filter_chain)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: webget-action_controller_mock
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- WebGet
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-02-05 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: webget@webget.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- lib/action_controller_mock.rb
|
26
|
+
has_rdoc: true
|
27
|
+
homepage: http://webget.com/
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
|
31
|
+
require_paths:
|
32
|
+
- lib
|
33
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: "0"
|
38
|
+
version:
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
requirements: []
|
46
|
+
|
47
|
+
rubyforge_project:
|
48
|
+
rubygems_version: 1.2.0
|
49
|
+
signing_key:
|
50
|
+
specification_version: 2
|
51
|
+
summary: Ruby On Rails ActionController::Base mock object for testing
|
52
|
+
test_files:
|
53
|
+
- test/unit/action_controller_mock_test.rb
|