edge_rider 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -2
  3. data/.ruby-version +1 -1
  4. data/.travis.yml +61 -10
  5. data/README.md +7 -8
  6. data/Rakefile +5 -61
  7. data/edge_rider.gemspec +2 -3
  8. data/gemfiles/Gemfile.2.3.mysql2 +16 -0
  9. data/gemfiles/Gemfile.2.3.mysql2.lock +37 -0
  10. data/gemfiles/Gemfile.3.2.mysql2 +16 -0
  11. data/gemfiles/Gemfile.3.2.mysql2.lock +62 -0
  12. data/gemfiles/Gemfile.4.2.mysql2 +15 -0
  13. data/gemfiles/Gemfile.4.2.mysql2.lock +66 -0
  14. data/gemfiles/Gemfile.4.2.pg +15 -0
  15. data/gemfiles/Gemfile.4.2.pg.lock +66 -0
  16. data/gemfiles/Gemfile.5.1.mysql2 +15 -0
  17. data/gemfiles/Gemfile.5.1.mysql2.lock +63 -0
  18. data/gemfiles/Gemfile.5.1.pg +15 -0
  19. data/gemfiles/Gemfile.5.1.pg.lock +63 -0
  20. data/lib/edge_rider.rb +2 -0
  21. data/lib/edge_rider/collect_column.rb +7 -1
  22. data/lib/edge_rider/collect_ids.rb +3 -3
  23. data/lib/edge_rider/development.rb +2 -15
  24. data/lib/edge_rider/util.rb +31 -2
  25. data/lib/edge_rider/version.rb +1 -1
  26. data/spec/{shared/spec/edge_rider → edge_rider}/collect_column_spec.rb +0 -0
  27. data/spec/{shared/spec/edge_rider → edge_rider}/collect_ids_spec.rb +2 -2
  28. data/spec/{shared/spec/edge_rider → edge_rider}/origin_class_spec.rb +0 -0
  29. data/spec/{shared/spec/edge_rider → edge_rider}/preload_associations_spec.rb +0 -0
  30. data/spec/{shared/spec/edge_rider → edge_rider}/scoped_spec.rb +2 -1
  31. data/spec/{shared/spec/edge_rider → edge_rider}/to_id_query_spec.rb +3 -3
  32. data/spec/{shared/spec/edge_rider → edge_rider}/to_sql_spec.rb +1 -1
  33. data/spec/{shared/spec/edge_rider → edge_rider}/traverse_association_spec.rb +0 -0
  34. data/spec/{shared/spec/edge_rider → edge_rider}/util_spec.rb +0 -0
  35. data/spec/spec_helper.rb +12 -0
  36. data/spec/support/database.rb +34 -0
  37. data/spec/{shared/app_root/config → support}/database.sample.yml +6 -2
  38. data/spec/support/database.travis.yml +9 -0
  39. data/spec/support/models.rb +92 -0
  40. metadata +60 -155
  41. data/spec/rails-2.3/.ruby-version +0 -1
  42. data/spec/rails-2.3/Gemfile +0 -17
  43. data/spec/rails-2.3/Gemfile.lock +0 -66
  44. data/spec/rails-2.3/Rakefile +0 -11
  45. data/spec/rails-2.3/app_root/config/boot.rb +0 -130
  46. data/spec/rails-2.3/app_root/config/environment.rb +0 -16
  47. data/spec/rails-2.3/app_root/config/environments/test.rb +0 -0
  48. data/spec/rails-2.3/app_root/config/initializers/fix_missing_source_file.rb +0 -1
  49. data/spec/rails-2.3/app_root/config/preinitializer.rb +0 -22
  50. data/spec/rails-2.3/app_root/config/routes.rb +0 -15
  51. data/spec/rails-2.3/app_root/log/.gitignore +0 -1
  52. data/spec/rails-2.3/rcov.opts +0 -2
  53. data/spec/rails-2.3/spec.opts +0 -5
  54. data/spec/rails-2.3/spec/spec_helper.rb +0 -25
  55. data/spec/rails-3.0/.rspec +0 -2
  56. data/spec/rails-3.0/.ruby-version +0 -1
  57. data/spec/rails-3.0/Gemfile +0 -12
  58. data/spec/rails-3.0/Gemfile.lock +0 -120
  59. data/spec/rails-3.0/Rakefile +0 -11
  60. data/spec/rails-3.0/app_root/.gitignore +0 -4
  61. data/spec/rails-3.0/app_root/config/application.rb +0 -33
  62. data/spec/rails-3.0/app_root/config/boot.rb +0 -15
  63. data/spec/rails-3.0/app_root/config/environment.rb +0 -7
  64. data/spec/rails-3.0/app_root/config/environments/test.rb +0 -37
  65. data/spec/rails-3.0/app_root/config/initializers/backtrace_silencers.rb +0 -9
  66. data/spec/rails-3.0/app_root/config/initializers/inflections.rb +0 -12
  67. data/spec/rails-3.0/app_root/config/initializers/mime_types.rb +0 -7
  68. data/spec/rails-3.0/app_root/config/initializers/secret_token.rb +0 -9
  69. data/spec/rails-3.0/app_root/config/initializers/session_store.rb +0 -10
  70. data/spec/rails-3.0/app_root/config/routes.rb +0 -5
  71. data/spec/rails-3.0/app_root/lib/tasks/.gitkeep +0 -0
  72. data/spec/rails-3.0/app_root/log/.gitkeep +0 -0
  73. data/spec/rails-3.0/app_root/script/rails +0 -6
  74. data/spec/rails-3.0/rcov.opts +0 -2
  75. data/spec/rails-3.0/spec/spec_helper.rb +0 -23
  76. data/spec/rails-3.2/.rspec +0 -2
  77. data/spec/rails-3.2/.ruby-version +0 -1
  78. data/spec/rails-3.2/Gemfile +0 -16
  79. data/spec/rails-3.2/Gemfile.lock +0 -135
  80. data/spec/rails-3.2/Rakefile +0 -12
  81. data/spec/rails-3.2/app_root/.gitignore +0 -4
  82. data/spec/rails-3.2/app_root/config/application.rb +0 -33
  83. data/spec/rails-3.2/app_root/config/boot.rb +0 -15
  84. data/spec/rails-3.2/app_root/config/environment.rb +0 -7
  85. data/spec/rails-3.2/app_root/config/environments/test.rb +0 -37
  86. data/spec/rails-3.2/app_root/config/initializers/backtrace_silencers.rb +0 -9
  87. data/spec/rails-3.2/app_root/config/initializers/inflections.rb +0 -12
  88. data/spec/rails-3.2/app_root/config/initializers/mime_types.rb +0 -7
  89. data/spec/rails-3.2/app_root/config/initializers/secret_token.rb +0 -9
  90. data/spec/rails-3.2/app_root/config/initializers/session_store.rb +0 -10
  91. data/spec/rails-3.2/app_root/config/routes.rb +0 -5
  92. data/spec/rails-3.2/app_root/log/.gitignore +0 -1
  93. data/spec/rails-3.2/rcov.opts +0 -2
  94. data/spec/rails-3.2/spec/spec_helper.rb +0 -25
  95. data/spec/rails-4.1/.rspec +0 -2
  96. data/spec/rails-4.1/.ruby-version +0 -1
  97. data/spec/rails-4.1/Gemfile +0 -17
  98. data/spec/rails-4.1/Gemfile.lock +0 -138
  99. data/spec/rails-4.1/Rakefile +0 -12
  100. data/spec/rails-4.1/app_root/.gitignore +0 -16
  101. data/spec/rails-4.1/app_root/bin/bundle +0 -3
  102. data/spec/rails-4.1/app_root/bin/rails +0 -8
  103. data/spec/rails-4.1/app_root/bin/rake +0 -8
  104. data/spec/rails-4.1/app_root/bin/spring +0 -18
  105. data/spec/rails-4.1/app_root/config/application.rb +0 -28
  106. data/spec/rails-4.1/app_root/config/boot.rb +0 -4
  107. data/spec/rails-4.1/app_root/config/environment.rb +0 -5
  108. data/spec/rails-4.1/app_root/config/environments/development.rb +0 -37
  109. data/spec/rails-4.1/app_root/config/environments/production.rb +0 -83
  110. data/spec/rails-4.1/app_root/config/environments/test.rb +0 -39
  111. data/spec/rails-4.1/app_root/config/initializers/backtrace_silencers.rb +0 -7
  112. data/spec/rails-4.1/app_root/config/initializers/cookies_serializer.rb +0 -3
  113. data/spec/rails-4.1/app_root/config/initializers/filter_parameter_logging.rb +0 -4
  114. data/spec/rails-4.1/app_root/config/initializers/inflections.rb +0 -16
  115. data/spec/rails-4.1/app_root/config/initializers/mime_types.rb +0 -4
  116. data/spec/rails-4.1/app_root/config/initializers/session_store.rb +0 -3
  117. data/spec/rails-4.1/app_root/config/initializers/wrap_parameters.rb +0 -14
  118. data/spec/rails-4.1/app_root/config/routes.rb +0 -3
  119. data/spec/rails-4.1/app_root/config/secrets.yml +0 -22
  120. data/spec/rails-4.1/rcov.opts +0 -2
  121. data/spec/rails-4.1/spec/spec_helper.rb +0 -31
  122. data/spec/shared/app_root/app/controllers/application_controller.rb +0 -5
  123. data/spec/shared/app_root/app/models/allow_setting_id_on_create.rb +0 -21
  124. data/spec/shared/app_root/app/models/forum.rb +0 -11
  125. data/spec/shared/app_root/app/models/post.rb +0 -11
  126. data/spec/shared/app_root/app/models/profile.rb +0 -8
  127. data/spec/shared/app_root/app/models/topic.rb +0 -14
  128. data/spec/shared/app_root/app/models/user.rb +0 -13
  129. data/spec/shared/app_root/config/database.travis_ci.yml +0 -6
  130. data/spec/shared/app_root/db/migrate/001_create_test_tables.rb +0 -45
@@ -1,39 +0,0 @@
1
- Rails.application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
9
-
10
- # Do not eager load code on boot. This avoids loading your whole application
11
- # just for the purpose of running a single test. If you are using a tool that
12
- # preloads Rails for running tests, you may have to set it to true.
13
- config.eager_load = false
14
-
15
- # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_assets = true
17
- config.static_cache_control = 'public, max-age=3600'
18
-
19
- # Show full error reports and disable caching.
20
- config.consider_all_requests_local = true
21
- config.action_controller.perform_caching = false
22
-
23
- # Raise exceptions instead of rendering exception templates.
24
- config.action_dispatch.show_exceptions = false
25
-
26
- # Disable request forgery protection in test environment.
27
- config.action_controller.allow_forgery_protection = false
28
-
29
- # Tell Action Mailer not to deliver emails to the real world.
30
- # The :test delivery method accumulates sent emails in the
31
- # ActionMailer::Base.deliveries array.
32
- config.action_mailer.delivery_method = :test
33
-
34
- # Print deprecation notices to the stderr.
35
- config.active_support.deprecation = :stderr
36
-
37
- # Raises error for missing translations
38
- # config.action_view.raise_on_missing_translations = true
39
- end
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,3 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -1,4 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Configure sensitive parameters which will be filtered from the log file.
4
- Rails.application.config.filter_parameters += [:password]
@@ -1,16 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format. Inflections
4
- # are locale specific, and you may define rules for as many different
5
- # locales as you wish. All of these examples are active by default:
6
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
- # inflect.plural /^(ox)$/i, '\1en'
8
- # inflect.singular /^(ox)en/i, '\1'
9
- # inflect.irregular 'person', 'people'
10
- # inflect.uncountable %w( fish sheep )
11
- # end
12
-
13
- # These inflection rules are supported but not enabled by default:
14
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
- # inflect.acronym 'RESTful'
16
- # end
@@ -1,4 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
@@ -1,3 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Rails.application.config.session_store :cookie_store, key: '_spec_app_session'
@@ -1,14 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # This file contains settings for ActionController::ParamsWrapper which
4
- # is enabled by default.
5
-
6
- # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
- ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
- end
10
-
11
- # To enable root element in JSON for ActiveRecord objects.
12
- # ActiveSupport.on_load(:active_record) do
13
- # self.include_root_in_json = true
14
- # end
@@ -1,3 +0,0 @@
1
- Rails.application.routes.draw do
2
- get ':controller(/:action(/:id(.:format)))'
3
- end
@@ -1,22 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key is used for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
-
6
- # Make sure the secret is at least 30 characters and all random,
7
- # no regular words or you'll be exposed to dictionary attacks.
8
- # You can use `rake secret` to generate a secure secret key.
9
-
10
- # Make sure the secrets in this file are kept private
11
- # if you're sharing your code publicly.
12
-
13
- development:
14
- secret_key_base: 7aa3418aec81500e8e336d984b9d438f602911ae48df0725543b9c72699a9fa84ce099b327d7db2b10f2655963f19139c9c4c86304b9342ccb9c7e389fc65b6e
15
-
16
- test:
17
- secret_key_base: 9eb558edf0b5fda539c566df1e3a5b699e7e16267167c797ce838d120a0d52c7c5672bada24457f0ed7b59786e360e2c27e9b9e021cbe98358dc72382cfcd50f
18
-
19
- # Do not keep production secrets in the repository,
20
- # instead read values from the environment.
21
- production:
22
- secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -1,2 +0,0 @@
1
- --exclude "spec/*,gems/*"
2
- --rails
@@ -1,31 +0,0 @@
1
- $: << File.join(File.dirname(__FILE__), "/../../lib" )
2
-
3
- ENV['RAILS_ENV'] ||= 'test'
4
- ENV['RAILS_ROOT'] = 'app_root'
5
-
6
- FileUtils.rm(Dir.glob("app_root/db/*.db"), :force => true)
7
-
8
- # Load the Rails environment and testing framework
9
- require "#{File.dirname(__FILE__)}/../app_root/config/environment"
10
- require 'rspec/rails'
11
- require 'edge_rider/development'
12
- DatabaseCleaner.strategy = :truncation
13
-
14
- require 'rspec_candy/helpers'
15
-
16
- # Run the migrations
17
- EdgeRider::Development.migrate_test_database
18
-
19
- RSpec.configure do |config|
20
- config.use_transactional_fixtures = false
21
- config.use_instantiated_fixtures = false
22
- config.before(:each) do
23
- DatabaseCleaner.clean
24
- end
25
- config.mock_with :rspec do |c|
26
- c.syntax = [:should, :expect]
27
- end
28
- config.expect_with :rspec do |c|
29
- c.syntax = [:should, :expect]
30
- end
31
- end
@@ -1,5 +0,0 @@
1
- # encoding: utf-8
2
-
3
- class ApplicationController < ActionController::Base
4
-
5
- end
@@ -1,21 +0,0 @@
1
- # Since our specs are mostly about working with IDs, this module can be
2
- # included in an ActiveRecord model class to allow setting the :id attribute
3
- # on create. This is forbidden by default.
4
- # http://stackoverflow.com/questions/431617/overriding-id-on-create-in-activerecord
5
- module AllowSettingIdOnCreate
6
-
7
- module RemoveIdFromProtectedAttributes
8
- def attributes_protected_by_default
9
- super - ['id']
10
- end
11
- end
12
-
13
- def self.included(base)
14
- if ActiveRecord::VERSION::MAJOR < 3 # Rails 2 has this as an instance method
15
- base.send(:include, RemoveIdFromProtectedAttributes)
16
- else # Rails 3 has this as a class method
17
- base.send(:extend, RemoveIdFromProtectedAttributes)
18
- end
19
- end
20
-
21
- end
@@ -1,11 +0,0 @@
1
- class Forum < ActiveRecord::Base
2
- include AllowSettingIdOnCreate
3
-
4
- has_many :topics
5
- has_many :posts, :through => :topics
6
- EdgeRider::Util.define_association self, :has_many, :active_topics,
7
- :conditions => { :trashed => false }, :class_name => 'Topic'
8
-
9
- has_defaults :trashed => false
10
-
11
- end
@@ -1,11 +0,0 @@
1
- class Post < ActiveRecord::Base
2
- include AllowSettingIdOnCreate
3
-
4
- belongs_to :topic
5
- belongs_to :author, :class_name => 'User'
6
-
7
- has_defaults :trashed => false
8
-
9
- EdgeRider::Util.define_scope self, :these, lambda { |array| { :conditions => { :id => array } } }
10
-
11
- end
@@ -1,8 +0,0 @@
1
- class Profile < ActiveRecord::Base
2
- include AllowSettingIdOnCreate
3
-
4
- belongs_to :user
5
-
6
- has_defaults :trashed => false
7
-
8
- end
@@ -1,14 +0,0 @@
1
- class Topic < ActiveRecord::Base
2
- include AllowSettingIdOnCreate
3
-
4
- belongs_to :forum
5
- EdgeRider::Util.define_association self, :belongs_to, :active_forum,
6
- :conditions => { :trashed => false }, :class_name => 'Forum'
7
-
8
- has_many :posts
9
- belongs_to :author, :class_name => 'User'
10
- has_many :post_authors, :through => :posts
11
-
12
- has_defaults :trashed => false
13
-
14
- end
@@ -1,13 +0,0 @@
1
- class User < ActiveRecord::Base
2
- include AllowSettingIdOnCreate
3
-
4
- has_many :posts
5
- has_many :topics
6
-
7
- has_one :profile
8
- EdgeRider::Util.define_association self, :has_one, :active_profile,
9
- :conditions => { :trashed => false }, :class_name => 'Profile'
10
-
11
- has_defaults :trashed => false
12
-
13
- end
@@ -1,6 +0,0 @@
1
- test:
2
- adapter: mysql2
3
- host: localhost
4
- username: root
5
- password:
6
- database: edge_rider_test
@@ -1,45 +0,0 @@
1
- class CreateTestTables < ActiveRecord::Migration
2
-
3
- def self.up
4
-
5
- create_table :forums do |t|
6
- t.string :name
7
- t.boolean :trashed
8
- end
9
-
10
- create_table :topics do |t|
11
- t.string :subject
12
- t.references :forum
13
- t.references :author
14
- t.boolean :trashed
15
- end
16
-
17
- create_table :posts do |t|
18
- t.text :body
19
- t.references :topic
20
- t.references :author
21
- t.boolean :trashed
22
- t.timestamps
23
- end
24
-
25
- create_table :users do |t|
26
- t.string :email
27
- t.boolean :trashed
28
- end
29
-
30
- create_table :profiles do |t|
31
- t.references :user
32
- t.text :hobbies
33
- t.boolean :trashed
34
- end
35
-
36
- end
37
-
38
- def self.down
39
- drop_table :forums
40
- drop_table :topics
41
- drop_table :posts
42
- drop_table :users
43
- end
44
-
45
- end