injector 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +60 -0
  3. data/Rakefile +38 -0
  4. data/lib/injector.rb +5 -0
  5. data/lib/injector/controller_method.rb +15 -0
  6. data/lib/injector/resolver.rb +55 -0
  7. data/lib/injector/version.rb +3 -0
  8. data/lib/tasks/injector_tasks.rake +4 -0
  9. data/test/dummy/README.rdoc +261 -0
  10. data/test/dummy/Rakefile +7 -0
  11. data/test/dummy/app/assets/javascripts/application.js +15 -0
  12. data/test/dummy/app/assets/javascripts/cars.js +2 -0
  13. data/test/dummy/app/assets/javascripts/dogs.js +2 -0
  14. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  15. data/test/dummy/app/assets/stylesheets/cars.css +4 -0
  16. data/test/dummy/app/assets/stylesheets/dogs.css +4 -0
  17. data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
  18. data/test/dummy/app/controllers/application_controller.rb +4 -0
  19. data/test/dummy/app/controllers/cars_controller.rb +47 -0
  20. data/test/dummy/app/controllers/dogs_controller.rb +50 -0
  21. data/test/dummy/app/helpers/application_helper.rb +2 -0
  22. data/test/dummy/app/helpers/cars_helper.rb +2 -0
  23. data/test/dummy/app/helpers/dogs_helper.rb +2 -0
  24. data/test/dummy/app/models/car.rb +3 -0
  25. data/test/dummy/app/models/dog.rb +3 -0
  26. data/test/dummy/app/views/cars/_form.html.erb +0 -0
  27. data/test/dummy/app/views/cars/edit.html.erb +0 -0
  28. data/test/dummy/app/views/cars/index.html.erb +0 -0
  29. data/test/dummy/app/views/cars/new.html.erb +0 -0
  30. data/test/dummy/app/views/cars/show.html.erb +0 -0
  31. data/test/dummy/app/views/dogs/_form.html.erb +0 -0
  32. data/test/dummy/app/views/dogs/edit.html.erb +0 -0
  33. data/test/dummy/app/views/dogs/index.html.erb +0 -0
  34. data/test/dummy/app/views/dogs/new.html.erb +0 -0
  35. data/test/dummy/app/views/dogs/show.html.erb +0 -0
  36. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  37. data/test/dummy/config.ru +4 -0
  38. data/test/dummy/config/application.rb +56 -0
  39. data/test/dummy/config/boot.rb +10 -0
  40. data/test/dummy/config/database.yml +25 -0
  41. data/test/dummy/config/environment.rb +5 -0
  42. data/test/dummy/config/environments/development.rb +37 -0
  43. data/test/dummy/config/environments/production.rb +67 -0
  44. data/test/dummy/config/environments/test.rb +37 -0
  45. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  46. data/test/dummy/config/initializers/inflections.rb +15 -0
  47. data/test/dummy/config/initializers/mime_types.rb +5 -0
  48. data/test/dummy/config/initializers/secret_token.rb +7 -0
  49. data/test/dummy/config/initializers/session_store.rb +8 -0
  50. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  51. data/test/dummy/config/locales/en.yml +5 -0
  52. data/test/dummy/config/routes.rb +60 -0
  53. data/test/dummy/db/development.sqlite3 +0 -0
  54. data/test/dummy/db/migrate/20120517025757_create_cars.rb +9 -0
  55. data/test/dummy/db/migrate/20120517043520_create_dogs.rb +9 -0
  56. data/test/dummy/db/schema.rb +28 -0
  57. data/test/dummy/db/test.sqlite3 +0 -0
  58. data/test/dummy/development.sqlite3 +0 -0
  59. data/test/dummy/log/development.log +202 -0
  60. data/test/dummy/log/test.log +3135 -0
  61. data/test/dummy/public/404.html +26 -0
  62. data/test/dummy/public/422.html +26 -0
  63. data/test/dummy/public/500.html +25 -0
  64. data/test/dummy/public/favicon.ico +0 -0
  65. data/test/dummy/script/rails +6 -0
  66. data/test/dummy/test/fixtures/cars.yml +7 -0
  67. data/test/dummy/test/fixtures/dogs.yml +7 -0
  68. data/test/dummy/test/functional/cars_controller_test.rb +46 -0
  69. data/test/dummy/test/functional/dogs_controller_test.rb +46 -0
  70. data/test/dummy/test/unit/car_test.rb +7 -0
  71. data/test/dummy/test/unit/dog_test.rb +7 -0
  72. data/test/dummy/test/unit/helpers/cars_helper_test.rb +4 -0
  73. data/test/dummy/test/unit/helpers/dogs_helper_test.rb +4 -0
  74. data/test/injector_test.rb +7 -0
  75. data/test/test_helper.rb +15 -0
  76. metadata +219 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ model: MyString
5
+
6
+ two:
7
+ model: MyString
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ name: MyString
5
+
6
+ two:
7
+ name: MyString
@@ -0,0 +1,46 @@
1
+ require 'test_helper'
2
+
3
+ class CarsControllerTest < ActionController::TestCase
4
+ tests CarsController
5
+
6
+ def setup
7
+ class << @controller
8
+ attr_accessor :cars, :car
9
+ end
10
+
11
+ @car = Car.new(model: "Camaro")
12
+ @car.save
13
+ end
14
+
15
+ def test_inject_to_index
16
+ get :index
17
+ assert @controller.cars.first == @car
18
+ end
19
+
20
+ def test_inject_to_show
21
+ get :show, id: @car.id
22
+ assert @controller.car == @car
23
+ end
24
+
25
+ def test_inject_to_new
26
+ get :new
27
+ assert !@controller.car.model?
28
+ end
29
+
30
+ def test_inject_to_edit
31
+ put :edit, id: @car.id
32
+ assert @controller.car == @car
33
+ end
34
+
35
+ def test_inject_to_create
36
+ car_model = "Mustang"
37
+ post :create, car: {model: car_model}
38
+ assert @controller.car.model == car_model
39
+ end
40
+
41
+ def test_inject_to_update
42
+ car_model = "Mustang"
43
+ put :update, {car: {model: car_model}, id: @car.id}
44
+ assert @controller.car.model == car_model
45
+ end
46
+ end
@@ -0,0 +1,46 @@
1
+ require 'test_helper'
2
+
3
+ class DogsControllerTest < ActionController::TestCase
4
+ tests DogsController
5
+
6
+ def setup
7
+ class << @controller
8
+ attr_accessor :dogs, :dog
9
+ end
10
+
11
+ @dog = Dog.new(name: "Dog")
12
+ @dog.save
13
+ end
14
+
15
+ def test_should_not_inject_to_index
16
+ get :index
17
+ assert @controller.dogs.nil?
18
+ end
19
+
20
+ def test_should_not_inject_to_show
21
+ get :show, id: @dog.id
22
+ assert @controller.dog.nil?
23
+ end
24
+
25
+ def test_should_not_inject_to_new
26
+ get :new
27
+ assert @controller.dog.nil?
28
+ end
29
+
30
+ def test_should_not_inject_to_edit
31
+ put :edit, id: @dog.id
32
+ assert @controller.dog.nil?
33
+ end
34
+
35
+ def test_should_not_inject_to_create
36
+ dog_name = "Goku"
37
+ post :create, dog: {name: dog_name}
38
+ assert @controller.dog.nil?
39
+ end
40
+
41
+ def test_should_not_inject_to_update
42
+ dog_name = "Goku"
43
+ put :update, {dog: {name: dog_name}, id: @dog.id}
44
+ assert @controller.dog.nil?
45
+ end
46
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class CarTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class DogTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class CarsHelperTest < ActionView::TestCase
4
+ end
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class DogsHelperTest < ActionView::TestCase
4
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class InjectorTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ car = Car.new
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+ # Load fixtures from the engine
13
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
+ end
metadata ADDED
@@ -0,0 +1,219 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: injector
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Lauro Caetano
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.3
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.3
30
+ - !ruby/object:Gem::Dependency
31
+ name: sqlite3
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: Inject model to controllers.
47
+ email:
48
+ - laurocaetano1@gmail.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - lib/injector/controller_method.rb
54
+ - lib/injector/resolver.rb
55
+ - lib/injector/version.rb
56
+ - lib/injector.rb
57
+ - lib/tasks/injector_tasks.rake
58
+ - MIT-LICENSE
59
+ - Rakefile
60
+ - README.md
61
+ - test/dummy/app/assets/javascripts/application.js
62
+ - test/dummy/app/assets/javascripts/cars.js
63
+ - test/dummy/app/assets/javascripts/dogs.js
64
+ - test/dummy/app/assets/stylesheets/application.css
65
+ - test/dummy/app/assets/stylesheets/cars.css
66
+ - test/dummy/app/assets/stylesheets/dogs.css
67
+ - test/dummy/app/assets/stylesheets/scaffold.css
68
+ - test/dummy/app/controllers/application_controller.rb
69
+ - test/dummy/app/controllers/cars_controller.rb
70
+ - test/dummy/app/controllers/dogs_controller.rb
71
+ - test/dummy/app/helpers/application_helper.rb
72
+ - test/dummy/app/helpers/cars_helper.rb
73
+ - test/dummy/app/helpers/dogs_helper.rb
74
+ - test/dummy/app/models/car.rb
75
+ - test/dummy/app/models/dog.rb
76
+ - test/dummy/app/views/cars/_form.html.erb
77
+ - test/dummy/app/views/cars/edit.html.erb
78
+ - test/dummy/app/views/cars/index.html.erb
79
+ - test/dummy/app/views/cars/new.html.erb
80
+ - test/dummy/app/views/cars/show.html.erb
81
+ - test/dummy/app/views/dogs/_form.html.erb
82
+ - test/dummy/app/views/dogs/edit.html.erb
83
+ - test/dummy/app/views/dogs/index.html.erb
84
+ - test/dummy/app/views/dogs/new.html.erb
85
+ - test/dummy/app/views/dogs/show.html.erb
86
+ - test/dummy/app/views/layouts/application.html.erb
87
+ - test/dummy/config/application.rb
88
+ - test/dummy/config/boot.rb
89
+ - test/dummy/config/database.yml
90
+ - test/dummy/config/environment.rb
91
+ - test/dummy/config/environments/development.rb
92
+ - test/dummy/config/environments/production.rb
93
+ - test/dummy/config/environments/test.rb
94
+ - test/dummy/config/initializers/backtrace_silencers.rb
95
+ - test/dummy/config/initializers/inflections.rb
96
+ - test/dummy/config/initializers/mime_types.rb
97
+ - test/dummy/config/initializers/secret_token.rb
98
+ - test/dummy/config/initializers/session_store.rb
99
+ - test/dummy/config/initializers/wrap_parameters.rb
100
+ - test/dummy/config/locales/en.yml
101
+ - test/dummy/config/routes.rb
102
+ - test/dummy/config.ru
103
+ - test/dummy/db/development.sqlite3
104
+ - test/dummy/db/migrate/20120517025757_create_cars.rb
105
+ - test/dummy/db/migrate/20120517043520_create_dogs.rb
106
+ - test/dummy/db/schema.rb
107
+ - test/dummy/db/test.sqlite3
108
+ - test/dummy/development.sqlite3
109
+ - test/dummy/log/development.log
110
+ - test/dummy/log/test.log
111
+ - test/dummy/public/404.html
112
+ - test/dummy/public/422.html
113
+ - test/dummy/public/500.html
114
+ - test/dummy/public/favicon.ico
115
+ - test/dummy/Rakefile
116
+ - test/dummy/README.rdoc
117
+ - test/dummy/script/rails
118
+ - test/dummy/test/fixtures/cars.yml
119
+ - test/dummy/test/fixtures/dogs.yml
120
+ - test/dummy/test/functional/cars_controller_test.rb
121
+ - test/dummy/test/functional/dogs_controller_test.rb
122
+ - test/dummy/test/unit/car_test.rb
123
+ - test/dummy/test/unit/dog_test.rb
124
+ - test/dummy/test/unit/helpers/cars_helper_test.rb
125
+ - test/dummy/test/unit/helpers/dogs_helper_test.rb
126
+ - test/injector_test.rb
127
+ - test/test_helper.rb
128
+ homepage: https://github.com/laurocaetano/injector
129
+ licenses: []
130
+ post_install_message:
131
+ rdoc_options: []
132
+ require_paths:
133
+ - lib
134
+ required_ruby_version: !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project:
148
+ rubygems_version: 1.8.24
149
+ signing_key:
150
+ specification_version: 3
151
+ summary: Injector to Controllers
152
+ test_files:
153
+ - test/dummy/app/assets/javascripts/application.js
154
+ - test/dummy/app/assets/javascripts/cars.js
155
+ - test/dummy/app/assets/javascripts/dogs.js
156
+ - test/dummy/app/assets/stylesheets/application.css
157
+ - test/dummy/app/assets/stylesheets/cars.css
158
+ - test/dummy/app/assets/stylesheets/dogs.css
159
+ - test/dummy/app/assets/stylesheets/scaffold.css
160
+ - test/dummy/app/controllers/application_controller.rb
161
+ - test/dummy/app/controllers/cars_controller.rb
162
+ - test/dummy/app/controllers/dogs_controller.rb
163
+ - test/dummy/app/helpers/application_helper.rb
164
+ - test/dummy/app/helpers/cars_helper.rb
165
+ - test/dummy/app/helpers/dogs_helper.rb
166
+ - test/dummy/app/models/car.rb
167
+ - test/dummy/app/models/dog.rb
168
+ - test/dummy/app/views/cars/_form.html.erb
169
+ - test/dummy/app/views/cars/edit.html.erb
170
+ - test/dummy/app/views/cars/index.html.erb
171
+ - test/dummy/app/views/cars/new.html.erb
172
+ - test/dummy/app/views/cars/show.html.erb
173
+ - test/dummy/app/views/dogs/_form.html.erb
174
+ - test/dummy/app/views/dogs/edit.html.erb
175
+ - test/dummy/app/views/dogs/index.html.erb
176
+ - test/dummy/app/views/dogs/new.html.erb
177
+ - test/dummy/app/views/dogs/show.html.erb
178
+ - test/dummy/app/views/layouts/application.html.erb
179
+ - test/dummy/config/application.rb
180
+ - test/dummy/config/boot.rb
181
+ - test/dummy/config/database.yml
182
+ - test/dummy/config/environment.rb
183
+ - test/dummy/config/environments/development.rb
184
+ - test/dummy/config/environments/production.rb
185
+ - test/dummy/config/environments/test.rb
186
+ - test/dummy/config/initializers/backtrace_silencers.rb
187
+ - test/dummy/config/initializers/inflections.rb
188
+ - test/dummy/config/initializers/mime_types.rb
189
+ - test/dummy/config/initializers/secret_token.rb
190
+ - test/dummy/config/initializers/session_store.rb
191
+ - test/dummy/config/initializers/wrap_parameters.rb
192
+ - test/dummy/config/locales/en.yml
193
+ - test/dummy/config/routes.rb
194
+ - test/dummy/config.ru
195
+ - test/dummy/db/development.sqlite3
196
+ - test/dummy/db/migrate/20120517025757_create_cars.rb
197
+ - test/dummy/db/migrate/20120517043520_create_dogs.rb
198
+ - test/dummy/db/schema.rb
199
+ - test/dummy/db/test.sqlite3
200
+ - test/dummy/development.sqlite3
201
+ - test/dummy/log/development.log
202
+ - test/dummy/log/test.log
203
+ - test/dummy/public/404.html
204
+ - test/dummy/public/422.html
205
+ - test/dummy/public/500.html
206
+ - test/dummy/public/favicon.ico
207
+ - test/dummy/Rakefile
208
+ - test/dummy/README.rdoc
209
+ - test/dummy/script/rails
210
+ - test/dummy/test/fixtures/cars.yml
211
+ - test/dummy/test/fixtures/dogs.yml
212
+ - test/dummy/test/functional/cars_controller_test.rb
213
+ - test/dummy/test/functional/dogs_controller_test.rb
214
+ - test/dummy/test/unit/car_test.rb
215
+ - test/dummy/test/unit/dog_test.rb
216
+ - test/dummy/test/unit/helpers/cars_helper_test.rb
217
+ - test/dummy/test/unit/helpers/dogs_helper_test.rb
218
+ - test/injector_test.rb
219
+ - test/test_helper.rb