favorite_it 0.0.1

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.
Files changed (54) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +47 -0
  3. data/Rakefile +40 -0
  4. data/app/controllers/favorites_controller.rb +19 -0
  5. data/app/models/favorite.rb +6 -0
  6. data/config/routes.rb +4 -0
  7. data/db/migrate/20121206184554_create_favorites.rb +12 -0
  8. data/lib/favorite_it.rb +10 -0
  9. data/lib/favorite_it/engine.rb +7 -0
  10. data/lib/favorite_it/version.rb +3 -0
  11. data/lib/generators/favorite_it/install/USAGE +12 -0
  12. data/lib/generators/favorite_it/install/install_generator.rb +15 -0
  13. data/lib/generators/favorite_it/install/templates/config/initializers/favorite_it.rb +2 -0
  14. data/lib/tasks/favorite_it_tasks.rake +4 -0
  15. data/spec/controllers/favorites_controller_spec.rb +95 -0
  16. data/spec/dummy/README.rdoc +261 -0
  17. data/spec/dummy/Rakefile +7 -0
  18. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  19. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  20. data/spec/dummy/app/controllers/application_controller.rb +9 -0
  21. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  22. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  23. data/spec/dummy/config.ru +4 -0
  24. data/spec/dummy/config/application.rb +59 -0
  25. data/spec/dummy/config/boot.rb +10 -0
  26. data/spec/dummy/config/database.yml +25 -0
  27. data/spec/dummy/config/environment.rb +5 -0
  28. data/spec/dummy/config/environments/development.rb +37 -0
  29. data/spec/dummy/config/environments/production.rb +67 -0
  30. data/spec/dummy/config/environments/test.rb +37 -0
  31. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  32. data/spec/dummy/config/initializers/inflections.rb +15 -0
  33. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  34. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  35. data/spec/dummy/config/initializers/session_store.rb +8 -0
  36. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  37. data/spec/dummy/config/locales/en.yml +5 -0
  38. data/spec/dummy/config/routes.rb +58 -0
  39. data/spec/dummy/db/development.sqlite3 +0 -0
  40. data/spec/dummy/db/schema.rb +27 -0
  41. data/spec/dummy/db/test.sqlite3 +0 -0
  42. data/spec/dummy/log/development.log +26 -0
  43. data/spec/dummy/log/test.log +3945 -0
  44. data/spec/dummy/public/404.html +26 -0
  45. data/spec/dummy/public/422.html +26 -0
  46. data/spec/dummy/public/500.html +25 -0
  47. data/spec/dummy/public/favicon.ico +0 -0
  48. data/spec/dummy/script/rails +6 -0
  49. data/spec/factories.rb +9 -0
  50. data/spec/models/favorite_spec.rb +22 -0
  51. data/spec/routing/favorites_routing_spec.rb +14 -0
  52. data/spec/spec_helper.rb +41 -0
  53. data/spec/support/user.rb +6 -0
  54. metadata +239 -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,9 @@
1
+ FactoryGirl.define do
2
+ factory :user
3
+
4
+ factory :favorite do
5
+ user
6
+ #hacky
7
+ association :favoriteable, factory: :user
8
+ end
9
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe Favorite do
4
+ it {should belong_to :user}
5
+ it {should belong_to :favoriteable}
6
+
7
+ [:user, :user_id, :favoriteable_type, :favoriteable_id].each do |attribute|
8
+ it { should_not allow_mass_assignment_of(attribute) }
9
+ end
10
+
11
+ describe :validations do
12
+ [:user, :favoriteable].each do |attribute|
13
+ it { should validate_presence_of(attribute) }
14
+ end
15
+ describe :uniqueness do
16
+ before do
17
+ FactoryGirl.create(:favorite)
18
+ end
19
+ pending { should validate_uniqueness_of(:favoriteable_id).scoped_to([:user_id, :favoriteable_type]) }
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe FavoritesController do
4
+ describe "routing" do
5
+ it "recognizes and generates #create" do
6
+ post("/favorites/1").should route_to(controller: "favorites", action: "create", model_id: "1")
7
+ favorites_path("1").should == "/favorites/1"
8
+ end
9
+ it "recognizes and generates #destroy" do
10
+ delete("/favorites/2/1").should route_to(controller: "favorites", action: "destroy", model_id: "1", id: "2")
11
+ favorite_path("2","1").should == "/favorites/2/1"
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,41 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
+ require 'rspec/rails'
5
+ require 'rspec/autorun'
6
+
7
+ # Requires supporting ruby files with custom matchers and macros, etc,
8
+ # in spec/support/ and its subdirectories.
9
+ ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
10
+ Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
11
+
12
+ RSpec.configure do |config|
13
+ # ## Mock Framework
14
+ #
15
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
16
+ #
17
+ # config.mock_with :mocha
18
+ # config.mock_with :flexmock
19
+ # config.mock_with :rr
20
+
21
+ config.include FactoryGirl::Syntax::Methods
22
+
23
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
24
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
25
+
26
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
27
+ # examples within a transaction, remove the following line or assign false
28
+ # instead of true.
29
+ config.use_transactional_fixtures = true
30
+
31
+ # If true, the base class of anonymous controllers will be inferred
32
+ # automatically. This will be the default behavior in future versions of
33
+ # rspec-rails.
34
+ config.infer_base_class_for_anonymous_controllers = false
35
+
36
+ # Run specs in random order to surface order dependencies. If you find an
37
+ # order dependency and want to debug it, you can fix the order by providing
38
+ # the seed, which is printed after each run.
39
+ # --seed 1234
40
+ config.order = "random"
41
+ end
@@ -0,0 +1,6 @@
1
+ class User < ActiveRecord::Base
2
+ has_many :favorites
3
+ ActiveRecord::Migration.create_table :users, temporary: true do |t|
4
+ t.string :name
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,239 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: favorite_it
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Pedro Nascimento
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.0
20
+ none: false
21
+ prerelease: false
22
+ name: rails
23
+ requirement: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: 3.2.0
28
+ none: false
29
+ type: :runtime
30
+ - !ruby/object:Gem::Dependency
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ none: false
37
+ prerelease: false
38
+ name: sqlite3
39
+ requirement: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ none: false
45
+ type: :development
46
+ - !ruby/object:Gem::Dependency
47
+ version_requirements: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ none: false
53
+ prerelease: false
54
+ name: rspec-rails
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ none: false
61
+ type: :development
62
+ - !ruby/object:Gem::Dependency
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ none: false
69
+ prerelease: false
70
+ name: pry-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ none: false
77
+ type: :development
78
+ - !ruby/object:Gem::Dependency
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ none: false
85
+ prerelease: false
86
+ name: factory_girl_rails
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ none: false
93
+ type: :development
94
+ - !ruby/object:Gem::Dependency
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ none: false
101
+ prerelease: false
102
+ name: shoulda-matchers
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ none: false
109
+ type: :development
110
+ description: Favorite stuff with this gem.
111
+ email:
112
+ - pedro@helabs.com.br
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - app/controllers/favorites_controller.rb
118
+ - app/models/favorite.rb
119
+ - config/routes.rb
120
+ - db/migrate/20121206184554_create_favorites.rb
121
+ - lib/favorite_it/engine.rb
122
+ - lib/favorite_it/version.rb
123
+ - lib/favorite_it.rb
124
+ - lib/generators/favorite_it/install/install_generator.rb
125
+ - lib/generators/favorite_it/install/templates/config/initializers/favorite_it.rb
126
+ - lib/generators/favorite_it/install/USAGE
127
+ - lib/tasks/favorite_it_tasks.rake
128
+ - MIT-LICENSE
129
+ - Rakefile
130
+ - README.md
131
+ - spec/controllers/favorites_controller_spec.rb
132
+ - spec/dummy/app/assets/javascripts/application.js
133
+ - spec/dummy/app/assets/stylesheets/application.css
134
+ - spec/dummy/app/controllers/application_controller.rb
135
+ - spec/dummy/app/helpers/application_helper.rb
136
+ - spec/dummy/app/views/layouts/application.html.erb
137
+ - spec/dummy/config/application.rb
138
+ - spec/dummy/config/boot.rb
139
+ - spec/dummy/config/database.yml
140
+ - spec/dummy/config/environment.rb
141
+ - spec/dummy/config/environments/development.rb
142
+ - spec/dummy/config/environments/production.rb
143
+ - spec/dummy/config/environments/test.rb
144
+ - spec/dummy/config/initializers/backtrace_silencers.rb
145
+ - spec/dummy/config/initializers/inflections.rb
146
+ - spec/dummy/config/initializers/mime_types.rb
147
+ - spec/dummy/config/initializers/secret_token.rb
148
+ - spec/dummy/config/initializers/session_store.rb
149
+ - spec/dummy/config/initializers/wrap_parameters.rb
150
+ - spec/dummy/config/locales/en.yml
151
+ - spec/dummy/config/routes.rb
152
+ - spec/dummy/config.ru
153
+ - spec/dummy/db/development.sqlite3
154
+ - spec/dummy/db/schema.rb
155
+ - spec/dummy/db/test.sqlite3
156
+ - spec/dummy/log/development.log
157
+ - spec/dummy/log/test.log
158
+ - spec/dummy/public/404.html
159
+ - spec/dummy/public/422.html
160
+ - spec/dummy/public/500.html
161
+ - spec/dummy/public/favicon.ico
162
+ - spec/dummy/Rakefile
163
+ - spec/dummy/README.rdoc
164
+ - spec/dummy/script/rails
165
+ - spec/factories.rb
166
+ - spec/models/favorite_spec.rb
167
+ - spec/routing/favorites_routing_spec.rb
168
+ - spec/spec_helper.rb
169
+ - spec/support/user.rb
170
+ homepage: http://helabs.com.br/opensource
171
+ licenses: []
172
+ post_install_message:
173
+ rdoc_options: []
174
+ require_paths:
175
+ - lib
176
+ required_ruby_version: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ! '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ segments:
182
+ - 0
183
+ hash: 433965026864516214
184
+ none: false
185
+ required_rubygems_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ segments:
191
+ - 0
192
+ hash: 433965026864516214
193
+ none: false
194
+ requirements: []
195
+ rubyforge_project:
196
+ rubygems_version: 1.8.24
197
+ signing_key:
198
+ specification_version: 3
199
+ summary: Favorite stuff with this gem.
200
+ test_files:
201
+ - spec/controllers/favorites_controller_spec.rb
202
+ - spec/dummy/app/assets/javascripts/application.js
203
+ - spec/dummy/app/assets/stylesheets/application.css
204
+ - spec/dummy/app/controllers/application_controller.rb
205
+ - spec/dummy/app/helpers/application_helper.rb
206
+ - spec/dummy/app/views/layouts/application.html.erb
207
+ - spec/dummy/config/application.rb
208
+ - spec/dummy/config/boot.rb
209
+ - spec/dummy/config/database.yml
210
+ - spec/dummy/config/environment.rb
211
+ - spec/dummy/config/environments/development.rb
212
+ - spec/dummy/config/environments/production.rb
213
+ - spec/dummy/config/environments/test.rb
214
+ - spec/dummy/config/initializers/backtrace_silencers.rb
215
+ - spec/dummy/config/initializers/inflections.rb
216
+ - spec/dummy/config/initializers/mime_types.rb
217
+ - spec/dummy/config/initializers/secret_token.rb
218
+ - spec/dummy/config/initializers/session_store.rb
219
+ - spec/dummy/config/initializers/wrap_parameters.rb
220
+ - spec/dummy/config/locales/en.yml
221
+ - spec/dummy/config/routes.rb
222
+ - spec/dummy/config.ru
223
+ - spec/dummy/db/development.sqlite3
224
+ - spec/dummy/db/schema.rb
225
+ - spec/dummy/db/test.sqlite3
226
+ - spec/dummy/log/development.log
227
+ - spec/dummy/log/test.log
228
+ - spec/dummy/public/404.html
229
+ - spec/dummy/public/422.html
230
+ - spec/dummy/public/500.html
231
+ - spec/dummy/public/favicon.ico
232
+ - spec/dummy/Rakefile
233
+ - spec/dummy/README.rdoc
234
+ - spec/dummy/script/rails
235
+ - spec/factories.rb
236
+ - spec/models/favorite_spec.rb
237
+ - spec/routing/favorites_routing_spec.rb
238
+ - spec/spec_helper.rb
239
+ - spec/support/user.rb