configvars_rails 0.4.1 → 0.4.2

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/.project CHANGED
@@ -5,6 +5,11 @@
5
5
  <projects>
6
6
  </projects>
7
7
  <buildSpec>
8
+ <buildCommand>
9
+ <name>com.aptana.ide.core.unifiedBuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
8
13
  </buildSpec>
9
14
  <natures>
10
15
  <nature>org.radrails.rails.core.railsnature</nature>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -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.1"
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-21}
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
@@ -1,5 +1,7 @@
1
1
  # :nodoc: stubbed, because controllers inherit from it
2
2
  class ApplicationController < ActionController::Base
3
+ layout 'application'
4
+
3
5
  prepend_view_path File.expand_path(
4
6
  '../../../lib/configvars_rails/generators/templates', __FILE__)
5
7
  end
@@ -0,0 +1,8 @@
1
+ class AuthTestController < ApplicationController
2
+ config_vars_auth
3
+
4
+ prepend_view_path File.expand_path('../views', __FILE__)
5
+
6
+ def index
7
+ end
8
+ end
@@ -5,6 +5,7 @@ class ActionController::TestCase
5
5
  @routes.draw do
6
6
  # NOTE: this route should be kept in sync with the config_vars template.
7
7
  config_vars
8
+ get 'auth_test' => 'auth_test#index'
8
9
  end
9
10
  ApplicationController.send :include, @routes.url_helpers
10
11
  end
File without changes
@@ -0,0 +1,8 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <body>
4
+ <h1>Application Layout</h1>
5
+
6
+ <%= yield %>
7
+ </body>
8
+ </html>
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: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
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-21 00:00:00 -04:00
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