configvars_rails 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.project +5 -0
- data/VERSION +1 -1
- data/configvars_rails.gemspec +8 -2
- data/lib/configvars_rails/controller.rb +1 -1
- data/test/config_vars_auth_api_test.rb +30 -0
- data/test/helpers/application_controller.rb +2 -0
- data/test/helpers/auth_test_controller.rb +8 -0
- data/test/helpers/routes.rb +1 -0
- data/test/helpers/views/auth_test/index.html.erb +0 -0
- data/test/helpers/views/layouts/application.html.erb +8 -0
- data/test/test_helper.rb +1 -0
- metadata +10 -4
data/.project
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
data/configvars_rails.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{configvars_rails}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Victor Costan"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-27}
|
13
13
|
s.description = %q{This gem provides a model and simple controller for
|
14
14
|
storing global application configuration in a database. This allows the
|
15
15
|
configuration to change without source code modifications.}
|
@@ -43,14 +43,18 @@ Gem::Specification.new do |s|
|
|
43
43
|
"lib/configvars_rails/model.rb",
|
44
44
|
"lib/configvars_rails/routes.rb",
|
45
45
|
"test/config_var_test.rb",
|
46
|
+
"test/config_vars_auth_api_test.rb",
|
46
47
|
"test/config_vars_controller_api_test.rb",
|
47
48
|
"test/descriptor_test.rb",
|
48
49
|
"test/helpers/application_controller.rb",
|
50
|
+
"test/helpers/auth_test_controller.rb",
|
49
51
|
"test/helpers/db_setup.rb",
|
50
52
|
"test/helpers/initializers.rb",
|
51
53
|
"test/helpers/rails.rb",
|
52
54
|
"test/helpers/routes.rb",
|
53
55
|
"test/helpers/view_helpers.rb",
|
56
|
+
"test/helpers/views/auth_test/index.html.erb",
|
57
|
+
"test/helpers/views/layouts/application.html.erb",
|
54
58
|
"test/routes_test.rb",
|
55
59
|
"test/test_helper.rb"
|
56
60
|
]
|
@@ -60,9 +64,11 @@ Gem::Specification.new do |s|
|
|
60
64
|
s.summary = %q{Global configuration variables for Rails 3 applications.}
|
61
65
|
s.test_files = [
|
62
66
|
"test/config_var_test.rb",
|
67
|
+
"test/config_vars_auth_api_test.rb",
|
63
68
|
"test/config_vars_controller_api_test.rb",
|
64
69
|
"test/descriptor_test.rb",
|
65
70
|
"test/helpers/application_controller.rb",
|
71
|
+
"test/helpers/auth_test_controller.rb",
|
66
72
|
"test/helpers/db_setup.rb",
|
67
73
|
"test/helpers/initializers.rb",
|
68
74
|
"test/helpers/rails.rb",
|
@@ -22,13 +22,13 @@ module ControllerClassMethods
|
|
22
22
|
# name is hardwired in other parts of the implementation.
|
23
23
|
def config_vars_controller
|
24
24
|
include ControllerInstanceMethods
|
25
|
+
layout 'config_vars'
|
25
26
|
end
|
26
27
|
|
27
28
|
# HTTP Basic for controller actions, using config_vars credentials.
|
28
29
|
def config_vars_auth(*args)
|
29
30
|
include AuthInstanceMethods
|
30
31
|
before_filter :config_vars_http_basic_check, *args
|
31
|
-
layout 'config_vars'
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require File.expand_path('../test_helper', __FILE__)
|
2
|
+
|
3
|
+
|
4
|
+
# Tests the methods injected by config_vars_controller.
|
5
|
+
class ConfigVarsAuthApiTest < ActionController::TestCase
|
6
|
+
tests AuthTestController
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@config_var = config_vars(:app_uri)
|
10
|
+
request.env['HTTP_AUTHORIZATION'] =
|
11
|
+
ActionController::HttpAuthentication::Basic.encode_credentials('config',
|
12
|
+
'vars')
|
13
|
+
end
|
14
|
+
|
15
|
+
test "should get index" do
|
16
|
+
get :index
|
17
|
+
assert_response :success
|
18
|
+
end
|
19
|
+
|
20
|
+
test "index should render with application layout" do
|
21
|
+
get :index
|
22
|
+
assert_select 'h1', 'Application Layout'
|
23
|
+
end
|
24
|
+
|
25
|
+
test "cannot access action without authentication" do
|
26
|
+
request.env.delete 'HTTP_AUTHORIZATION'
|
27
|
+
get :index
|
28
|
+
assert_response :unauthorized
|
29
|
+
end
|
30
|
+
end
|
data/test/helpers/routes.rb
CHANGED
File without changes
|
data/test/test_helper.rb
CHANGED
@@ -12,6 +12,7 @@ require 'configvars_rails'
|
|
12
12
|
require 'helpers/view_helpers.rb'
|
13
13
|
# NOTE: application_controller has to follow view_helpers
|
14
14
|
require 'helpers/application_controller.rb'
|
15
|
+
require 'helpers/auth_test_controller.rb'
|
15
16
|
require 'helpers/db_setup.rb'
|
16
17
|
require 'helpers/initializers.rb'
|
17
18
|
require 'helpers/routes.rb'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configvars_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 2
|
10
|
+
version: 0.4.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Victor Costan
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-27 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -87,14 +87,18 @@ files:
|
|
87
87
|
- lib/configvars_rails/model.rb
|
88
88
|
- lib/configvars_rails/routes.rb
|
89
89
|
- test/config_var_test.rb
|
90
|
+
- test/config_vars_auth_api_test.rb
|
90
91
|
- test/config_vars_controller_api_test.rb
|
91
92
|
- test/descriptor_test.rb
|
92
93
|
- test/helpers/application_controller.rb
|
94
|
+
- test/helpers/auth_test_controller.rb
|
93
95
|
- test/helpers/db_setup.rb
|
94
96
|
- test/helpers/initializers.rb
|
95
97
|
- test/helpers/rails.rb
|
96
98
|
- test/helpers/routes.rb
|
97
99
|
- test/helpers/view_helpers.rb
|
100
|
+
- test/helpers/views/auth_test/index.html.erb
|
101
|
+
- test/helpers/views/layouts/application.html.erb
|
98
102
|
- test/routes_test.rb
|
99
103
|
- test/test_helper.rb
|
100
104
|
has_rdoc: true
|
@@ -133,9 +137,11 @@ specification_version: 3
|
|
133
137
|
summary: Global configuration variables for Rails 3 applications.
|
134
138
|
test_files:
|
135
139
|
- test/config_var_test.rb
|
140
|
+
- test/config_vars_auth_api_test.rb
|
136
141
|
- test/config_vars_controller_api_test.rb
|
137
142
|
- test/descriptor_test.rb
|
138
143
|
- test/helpers/application_controller.rb
|
144
|
+
- test/helpers/auth_test_controller.rb
|
139
145
|
- test/helpers/db_setup.rb
|
140
146
|
- test/helpers/initializers.rb
|
141
147
|
- test/helpers/rails.rb
|