merit 2.4.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +3 -35
  3. data/NEWS.md +31 -0
  4. data/README.md +15 -3
  5. data/RELEASING.md +16 -0
  6. data/Rakefile +13 -1
  7. data/app/models/merit/badge.rb +2 -19
  8. data/lib/merit.rb +13 -35
  9. data/lib/merit/{rules_badge_methods.rb → badge_rules_methods.rb} +0 -0
  10. data/lib/merit/base_target_finder.rb +1 -6
  11. data/lib/merit/{model_additions.rb → class_methods.rb} +2 -19
  12. data/lib/merit/controller_extensions.rb +13 -30
  13. data/lib/{generators → merit/generators}/active_record/install_generator.rb +12 -8
  14. data/lib/{generators → merit/generators}/active_record/merit_generator.rb +7 -3
  15. data/lib/{generators → merit/generators}/active_record/remove_generator.rb +9 -5
  16. data/lib/{generators/active_record/templates/add_merit_fields_to_model.rb → merit/generators/active_record/templates/add_merit_fields_to_model.erb} +1 -1
  17. data/lib/{generators/active_record/templates/create_badges_sashes.rb → merit/generators/active_record/templates/create_badges_sashes.erb} +1 -1
  18. data/lib/{generators/active_record/templates/create_merit_actions.rb → merit/generators/active_record/templates/create_merit_actions.erb} +2 -2
  19. data/lib/{generators/active_record/templates/create_merit_activity_logs.rb → merit/generators/active_record/templates/create_merit_activity_logs.erb} +1 -1
  20. data/lib/merit/generators/active_record/templates/create_sashes.erb +7 -0
  21. data/lib/{generators/active_record/templates/create_scores_and_points.rb → merit/generators/active_record/templates/create_scores_and_points.erb} +2 -2
  22. data/lib/{generators/active_record/templates/remove_merit_fields_from_model.rb → merit/generators/active_record/templates/remove_merit_fields_from_model.erb} +1 -1
  23. data/lib/{generators/active_record/templates/remove_merit_tables.rb → merit/generators/active_record/templates/remove_merit_tables.erb} +1 -1
  24. data/lib/merit/generators/install_generator.rb +18 -0
  25. data/lib/{generators/merit → merit/generators}/merit_generator.rb +3 -1
  26. data/lib/{generators/merit → merit/generators}/remove_generator.rb +3 -1
  27. data/lib/{generators/merit/templates/merit.rb → merit/generators/templates/merit.erb} +0 -3
  28. data/lib/{generators/merit/templates/merit_badge_rules.rb → merit/generators/templates/merit_badge_rules.erb} +0 -0
  29. data/lib/{generators/merit/templates/merit_point_rules.rb → merit/generators/templates/merit_point_rules.erb} +0 -0
  30. data/lib/{generators/merit/templates/merit_rank_rules.rb → merit/generators/templates/merit_rank_rules.erb} +0 -0
  31. data/{app/models/merit/action.rb → lib/merit/models/action_concern.rb} +12 -10
  32. data/lib/merit/models/active_record/action.rb +11 -0
  33. data/lib/merit/models/active_record/{merit/activity_log.rb → activity_log.rb} +4 -6
  34. data/lib/merit/models/active_record/{merit/badges_sash.rb → badges_sash.rb} +4 -4
  35. data/lib/merit/models/active_record/{merit/sash.rb → sash.rb} +5 -2
  36. data/lib/merit/models/active_record/{merit/score.rb → score.rb} +4 -1
  37. data/lib/merit/models/badges_sash_concern.rb +13 -0
  38. data/lib/merit/models/base/badges_sash.rb +1 -1
  39. data/lib/merit/models/base/sash.rb +1 -1
  40. data/lib/merit/models/sash_concern.rb +53 -0
  41. data/lib/merit/{rules_points_methods.rb → point_rules_methods.rb} +0 -0
  42. data/lib/merit/{rules_rank_methods.rb → rank_rules_methods.rb} +3 -18
  43. data/merit.gemspec +7 -5
  44. data/test/dummy/app/controllers/comments_controller.rb +1 -1
  45. data/test/dummy/app/controllers/registrations_controller.rb +1 -1
  46. data/test/dummy/app/models/address.rb +1 -12
  47. data/test/dummy/app/models/comment.rb +3 -25
  48. data/test/dummy/app/models/user.rb +1 -18
  49. data/test/dummy/config/application.rb +8 -10
  50. data/test/dummy/config/application_api_only.rb +28 -0
  51. data/test/dummy/config/environment_api_only.rb +7 -0
  52. data/test/dummy/config/environments/test.rb +1 -1
  53. data/test/dummy/config/initializers/new_framework_defaults.rb +3 -0
  54. data/test/dummy/db/migrate/20110421191249_create_users.rb +2 -2
  55. data/test/dummy/db/migrate/20110421191250_create_comments.rb +2 -2
  56. data/test/dummy/db/migrate/20120318022220_add_fields_to_users.rb +1 -1
  57. data/test/dummy/db/migrate/20130321082817_add_fields_to_comments.rb +1 -1
  58. data/test/dummy/db/migrate/20130329224406_create_merit_actions.rb +2 -2
  59. data/test/dummy/db/migrate/20130329224407_create_merit_activity_logs.rb +1 -1
  60. data/test/dummy/db/migrate/20130329224408_create_sashes.rb +2 -2
  61. data/test/dummy/db/migrate/20130329224409_create_badges_sashes.rb +1 -1
  62. data/test/dummy/db/migrate/20130329224410_create_scores_and_points.rb +1 -1
  63. data/test/dummy/db/migrate/20140211144001_create_addresses.rb +1 -1
  64. data/test/dummy/db/migrate/20140819133931_add_target_data_to_merit_actions.rb +1 -1
  65. data/test/dummy/db/schema.rb +55 -59
  66. data/test/integration/navigation_test.rb +2 -2
  67. data/test/test_helper.rb +11 -12
  68. data/test/unit/base_target_finder_test.rb +7 -26
  69. data/test/unit/merit_unit_test.rb +13 -17
  70. data/test/unit/rule_unit_test.rb +15 -8
  71. data/test/unit/rules_matcher_test.rb +9 -6
  72. data/test/unit/sash_finder_test.rb +5 -5
  73. data/test/unit/score_test.rb +1 -1
  74. data/test/unit/target_finder_test.rb +13 -13
  75. metadata +61 -70
  76. data/UPGRADING.md +0 -256
  77. data/lib/generators/active_record/templates/add_target_data_to_merit_actions.rb +0 -5
  78. data/lib/generators/active_record/templates/create_sashes.rb +0 -7
  79. data/lib/generators/active_record/upgrade_generator.rb +0 -36
  80. data/lib/generators/merit/install_generator.rb +0 -16
  81. data/lib/generators/merit/upgrade_generator.rb +0 -7
  82. data/lib/merit/models/active_record/merit/action.rb +0 -12
  83. data/lib/merit/models/mongoid/merit/action.rb +0 -18
  84. data/lib/merit/models/mongoid/merit/activity_log.rb +0 -11
  85. data/lib/merit/models/mongoid/merit/badges_sash.rb +0 -22
  86. data/lib/merit/models/mongoid/merit/sash.rb +0 -30
  87. data/lib/merit/models/mongoid/merit/score.rb +0 -45
  88. data/test/dummy/db/migrate/20140906225844_create_players.rb +0 -8
  89. data/test/dummy/public/javascripts/application.js +0 -2
  90. data/test/dummy/public/javascripts/controls.js +0 -965
  91. data/test/dummy/public/javascripts/dragdrop.js +0 -974
  92. data/test/dummy/public/javascripts/effects.js +0 -1123
  93. data/test/dummy/public/javascripts/prototype.js +0 -6001
  94. data/test/dummy/public/javascripts/rails.js +0 -191
  95. data/test/orm/active_record.rb +0 -2
  96. data/test/orm/mongoid.rb +0 -6
  97. data/test/orm_models/active_record.rb +0 -11
  98. data/test/orm_models/mongoid.rb +0 -15
@@ -33,7 +33,7 @@ class CommentsController < ApplicationController
33
33
 
34
34
  def update
35
35
  @comment = Comment.find(params[:id])
36
- if @comment.update_attributes(comment_params)
36
+ if @comment.update(comment_params)
37
37
  redirect_to(@comment, :notice => 'Comment was successfully updated.')
38
38
  else
39
39
  render "edit"
@@ -3,7 +3,7 @@ class RegistrationsController < ApplicationController
3
3
  @user = User.find(params[:id])
4
4
 
5
5
  respond_to do |format|
6
- if @user.update_attributes(user_params)
6
+ if @user.update(user_params)
7
7
  format.html { redirect_to(@user, :notice => 'User was successfully updated.') }
8
8
  format.xml { head :ok }
9
9
  else
@@ -1,14 +1,3 @@
1
- case Merit.orm
2
- when :active_record
3
- class Address < ActiveRecord::Base
4
- end
5
- when :mongoid
6
- class Address
7
- include Mongoid::Document
8
- include Mongoid::Timestamps
9
- end
10
- end
11
-
12
- class Address
1
+ class Address < ActiveRecord::Base
13
2
  belongs_to :user
14
3
  end
@@ -1,34 +1,12 @@
1
- case Merit.orm
2
- when :active_record
3
- class Comment < ActiveRecord::Base
4
- def friend
5
- User.find_by_name('friend')
6
- end
1
+ class Comment < ActiveRecord::Base
2
+ def friend
3
+ User.find_by_name('friend')
7
4
  end
8
- when :mongoid
9
- class Comment
10
- include Mongoid::Document
11
- include Mongoid::Timestamps
12
5
 
13
- field :name, :type => String
14
- field :comment, :type => String
15
- field :votes, :type => Integer, :default => 0
16
-
17
- def friend
18
- User.find_by(name: 'friend')
19
- end
20
- end
21
- end
22
-
23
- class Comment
24
6
  has_merit
25
7
 
26
8
  belongs_to :user
27
9
 
28
- if show_attr_accessible?
29
- attr_accessible :name, :comment, :user_id, :votes
30
- end
31
-
32
10
  validates :name, :comment, :user_id, :presence => true
33
11
 
34
12
  delegate :comments, :to => :user, :prefix => true
@@ -1,26 +1,9 @@
1
- case Merit.orm
2
- when :active_record
3
- class User < ActiveRecord::Base
4
- end
5
- when :mongoid
6
- class User
7
- include Mongoid::Document
8
- include Mongoid::Timestamps
9
-
10
- field :name, :type => String
11
- end
12
- end
13
-
14
- class User
1
+ class User < ActiveRecord::Base
15
2
  has_merit
16
3
 
17
4
  has_many :addresses
18
5
  has_many :comments
19
6
 
20
- if show_attr_accessible?
21
- attr_accessible :name
22
- end
23
-
24
7
  def model_with_no_reputation
25
8
  addresses.first || addresses.create
26
9
  end
@@ -10,19 +10,17 @@ Bundler.require
10
10
  require "merit"
11
11
 
12
12
  module Dummy
13
- class Application < Rails::Application
14
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
15
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
16
- # config.i18n.default_locale = :de
17
- # config.active_record.whitelist_attributes = true
13
+ class Application < ::Rails::Application
14
+ if Rails.version.match? "5.2.+"
15
+ config.active_record.sqlite3.represent_boolean_as_integer = true
16
+ end
18
17
 
19
- # http://stackoverflow.com/questions/20361428/rails-i18n-validation-deprecation-warning
20
- config.i18n.enforce_available_locales = true
18
+ if Rails.version.match? "6.0.+"
19
+ config.load_defaults "6.0"
20
+ end
21
21
 
22
- # Configure the default encoding used in templates for Ruby 1.9.
22
+ config.i18n.enforce_available_locales = true
23
23
  config.encoding = "utf-8"
24
-
25
- # Configure sensitive parameters which will be filtered from the log file.
26
24
  config.filter_parameters += [:password]
27
25
  end
28
26
  end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "boot"
4
+
5
+ require "rails"
6
+ # Pick the frameworks you want:
7
+ require "active_model/railtie"
8
+ require "active_record/railtie"
9
+ require "action_controller/railtie"
10
+ require "action_view/railtie"
11
+ require "action_mailer/railtie"
12
+
13
+ # require "sprockets/railtie"
14
+ require "rails/test_unit/railtie"
15
+
16
+ # Require the gems listed in Gemfile, including any gems
17
+ # you've limited to :test, :development, or :production.
18
+ Bundler.require
19
+ require "merit"
20
+
21
+ module Dummy
22
+ class Application < ::Rails::Application
23
+ config.load_defaults 5.2 if ENV["RAILS_VERSION"] =~ /^5.2/
24
+ config.api_only = true
25
+ config.i18n.enforce_available_locales = true
26
+ config.encoding = "utf-8"
27
+ end
28
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Load the rails application
4
+ require File.expand_path("application_api_only", __dir__)
5
+
6
+ # Initialize the rails application
7
+ Dummy::Application.initialize!
@@ -32,5 +32,5 @@ Dummy::Application.configure do
32
32
  # Print deprecation notices to the stderr
33
33
  config.active_support.deprecation = :stderr
34
34
 
35
- config.eager_load = ENV['RAILS_VERSION'] == '4.0' || ENV['RAILS_VERSION'] == '4.0-protected-attributes'
35
+ config.eager_load = false
36
36
  end
@@ -0,0 +1,3 @@
1
+ if Rails.version >= "5.1"
2
+ Rails.application.config.active_record.belongs_to_required_by_default = true
3
+ end
@@ -1,8 +1,8 @@
1
- class CreateUsers < ActiveRecord::Migration
1
+ class CreateUsers < ActiveRecord::Migration[5.0]
2
2
  def self.up
3
3
  create_table :users do |t|
4
4
  t.string :name
5
- t.timestamps
5
+ t.timestamps null: false
6
6
  end
7
7
  end
8
8
 
@@ -1,4 +1,4 @@
1
- class CreateComments < ActiveRecord::Migration
1
+ class CreateComments < ActiveRecord::Migration[5.0]
2
2
  def self.up
3
3
  create_table :comments do |t|
4
4
  t.string :name
@@ -6,7 +6,7 @@ class CreateComments < ActiveRecord::Migration
6
6
  t.integer :user_id
7
7
  t.integer :votes, :default => 0
8
8
 
9
- t.timestamps
9
+ t.timestamps null: false
10
10
  end
11
11
  end
12
12
 
@@ -1,4 +1,4 @@
1
- class AddFieldsToUsers < ActiveRecord::Migration
1
+ class AddFieldsToUsers < ActiveRecord::Migration[5.0]
2
2
  def self.up
3
3
  add_column :users, :sash_id, :integer
4
4
  add_column :users, :level, :integer, :default => 0
@@ -1,4 +1,4 @@
1
- class AddFieldsToComments < ActiveRecord::Migration
1
+ class AddFieldsToComments < ActiveRecord::Migration[5.0]
2
2
  def self.up
3
3
  add_column :comments, :sash_id, :integer
4
4
  add_column :comments, :level, :integer, :default => 0
@@ -1,4 +1,4 @@
1
- class CreateMeritActions < ActiveRecord::Migration
1
+ class CreateMeritActions < ActiveRecord::Migration[5.0]
2
2
  def self.up
3
3
  create_table :merit_actions do |t|
4
4
  t.integer :user_id # source
@@ -8,7 +8,7 @@ class CreateMeritActions < ActiveRecord::Migration
8
8
  t.string :target_model
9
9
  t.integer :target_id
10
10
  t.boolean :processed, :default => false
11
- t.timestamps
11
+ t.timestamps null: false
12
12
  end
13
13
  end
14
14
 
@@ -1,4 +1,4 @@
1
- class CreateMeritActivityLogs < ActiveRecord::Migration
1
+ class CreateMeritActivityLogs < ActiveRecord::Migration[5.0]
2
2
  def self.up
3
3
  create_table :merit_activity_logs do |t|
4
4
  t.integer :action_id
@@ -1,7 +1,7 @@
1
- class CreateSashes < ActiveRecord::Migration
1
+ class CreateSashes < ActiveRecord::Migration[5.0]
2
2
  def self.up
3
3
  create_table :sashes do |t|
4
- t.timestamps
4
+ t.timestamps null: false
5
5
  end
6
6
  end
7
7
 
@@ -1,4 +1,4 @@
1
- class CreateBadgesSashes < ActiveRecord::Migration
1
+ class CreateBadgesSashes < ActiveRecord::Migration[5.0]
2
2
  def self.up
3
3
  create_table :badges_sashes do |t|
4
4
  t.integer :badge_id, :sash_id
@@ -1,4 +1,4 @@
1
- class CreateScoresAndPoints < ActiveRecord::Migration
1
+ class CreateScoresAndPoints < ActiveRecord::Migration[5.0]
2
2
  def self.up
3
3
  create_table :merit_scores do |t|
4
4
  t.references :sash
@@ -1,4 +1,4 @@
1
- class CreateAddresses < ActiveRecord::Migration
1
+ class CreateAddresses < ActiveRecord::Migration[5.0]
2
2
  def up
3
3
  create_table :addresses do |t|
4
4
  t.references :user
@@ -1,4 +1,4 @@
1
- class AddTargetDataToMeritActions < ActiveRecord::Migration
1
+ class AddTargetDataToMeritActions < ActiveRecord::Migration[5.0]
2
2
  def change
3
3
  add_column :merit_actions, :target_data, :text
4
4
  end
@@ -1,93 +1,89 @@
1
- # encoding: UTF-8
2
1
  # This file is auto-generated from the current state of the database. Instead
3
2
  # of editing this file, please use the migrations feature of Active Record to
4
3
  # incrementally modify your database, and then regenerate this schema definition.
5
4
  #
6
- # Note that this schema.rb definition is the authoritative source for your
7
- # database schema. If you need to create the application database on another
8
- # system, you should be using db:schema:load, not running all the migrations
9
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
- # you'll amass, the slower it'll run and the greater likelihood for issues).
5
+ # This file is the source Rails uses to define your schema when running `rails
6
+ # db:schema:load`. When creating a new database, `rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
11
10
  #
12
11
  # It's strongly recommended that you check this file into your version control system.
13
12
 
14
- ActiveRecord::Schema.define(version: 20140906225844) do
13
+ ActiveRecord::Schema.define(version: 2014_08_19_133931) do
15
14
 
16
- create_table "addresses", force: true do |t|
15
+ create_table "addresses", force: :cascade do |t|
17
16
  t.integer "user_id"
17
+ t.index ["user_id"], name: "index_addresses_on_user_id"
18
18
  end
19
19
 
20
- create_table "badges_sashes", force: true do |t|
21
- t.integer "badge_id"
22
- t.integer "sash_id"
23
- t.boolean "notified_user", default: false
20
+ create_table "badges_sashes", force: :cascade do |t|
21
+ t.integer "badge_id"
22
+ t.integer "sash_id"
23
+ t.boolean "notified_user", default: false
24
24
  t.datetime "created_at"
25
+ t.index ["badge_id", "sash_id"], name: "index_badges_sashes_on_badge_id_and_sash_id"
26
+ t.index ["badge_id"], name: "index_badges_sashes_on_badge_id"
27
+ t.index ["sash_id"], name: "index_badges_sashes_on_sash_id"
25
28
  end
26
29
 
27
- add_index "badges_sashes", ["badge_id", "sash_id"], name: "index_badges_sashes_on_badge_id_and_sash_id"
28
- add_index "badges_sashes", ["badge_id"], name: "index_badges_sashes_on_badge_id"
29
- add_index "badges_sashes", ["sash_id"], name: "index_badges_sashes_on_sash_id"
30
-
31
- create_table "comments", force: true do |t|
32
- t.string "name"
33
- t.text "comment"
34
- t.integer "user_id"
35
- t.integer "votes", default: 0
36
- t.datetime "created_at", null: false
37
- t.datetime "updated_at", null: false
38
- t.integer "sash_id"
39
- t.integer "level", default: 0
30
+ create_table "comments", force: :cascade do |t|
31
+ t.string "name"
32
+ t.text "comment"
33
+ t.integer "user_id"
34
+ t.integer "votes", default: 0
35
+ t.datetime "created_at", null: false
36
+ t.datetime "updated_at", null: false
37
+ t.integer "sash_id"
38
+ t.integer "level", default: 0
40
39
  end
41
40
 
42
- create_table "merit_actions", force: true do |t|
43
- t.integer "user_id"
44
- t.string "action_method"
45
- t.integer "action_value"
46
- t.boolean "had_errors", default: false
47
- t.string "target_model"
48
- t.integer "target_id"
49
- t.boolean "processed", default: false
50
- t.datetime "created_at", null: false
51
- t.datetime "updated_at", null: false
52
- t.text "target_data"
41
+ create_table "merit_actions", force: :cascade do |t|
42
+ t.integer "user_id"
43
+ t.string "action_method"
44
+ t.integer "action_value"
45
+ t.boolean "had_errors", default: false
46
+ t.string "target_model"
47
+ t.integer "target_id"
48
+ t.boolean "processed", default: false
49
+ t.datetime "created_at", null: false
50
+ t.datetime "updated_at", null: false
51
+ t.text "target_data"
53
52
  end
54
53
 
55
- create_table "merit_activity_logs", force: true do |t|
56
- t.integer "action_id"
57
- t.string "related_change_type"
58
- t.integer "related_change_id"
59
- t.string "description"
54
+ create_table "merit_activity_logs", force: :cascade do |t|
55
+ t.integer "action_id"
56
+ t.string "related_change_type"
57
+ t.integer "related_change_id"
58
+ t.string "description"
60
59
  t.datetime "created_at"
61
60
  end
62
61
 
63
- create_table "merit_score_points", force: true do |t|
64
- t.integer "score_id"
65
- t.integer "num_points", default: 0
66
- t.string "log"
62
+ create_table "merit_score_points", force: :cascade do |t|
63
+ t.integer "score_id"
64
+ t.integer "num_points", default: 0
65
+ t.string "log"
67
66
  t.datetime "created_at"
67
+ t.index ["score_id"], name: "index_merit_score_points_on_score_id"
68
68
  end
69
69
 
70
- create_table "merit_scores", force: true do |t|
71
- t.integer "sash_id"
72
- t.string "category", default: "default"
73
- end
74
-
75
- create_table "players", force: true do |t|
70
+ create_table "merit_scores", force: :cascade do |t|
76
71
  t.integer "sash_id"
77
- t.integer "level", default: 0
72
+ t.string "category", default: "default"
73
+ t.index ["sash_id"], name: "index_merit_scores_on_sash_id"
78
74
  end
79
75
 
80
- create_table "sashes", force: true do |t|
76
+ create_table "sashes", force: :cascade do |t|
81
77
  t.datetime "created_at", null: false
82
78
  t.datetime "updated_at", null: false
83
79
  end
84
80
 
85
- create_table "users", force: true do |t|
86
- t.string "name"
87
- t.datetime "created_at", null: false
88
- t.datetime "updated_at", null: false
89
- t.integer "sash_id"
90
- t.integer "level", default: 0
81
+ create_table "users", force: :cascade do |t|
82
+ t.string "name"
83
+ t.datetime "created_at", null: false
84
+ t.datetime "updated_at", null: false
85
+ t.integer "sash_id"
86
+ t.integer "level", default: 0
91
87
  end
92
88
 
93
89
  end
@@ -305,8 +305,8 @@ class NavigationTest < ActionDispatch::IntegrationTest
305
305
  end
306
306
  end
307
307
 
308
- comment_1.reload.points.must_be :==, 2
309
- comment_2.reload.points.must_be :==, 2
308
+ _(comment_1.reload.points).must_be :==, 2
309
+ _(comment_2.reload.points).must_be :==, 2
310
310
  end
311
311
 
312
312
  test 'api/comments#show should grant 1 point to user' do
@@ -1,6 +1,6 @@
1
1
  # Configure Rails Envinronment
2
2
  ENV['RAILS_ENV'] = 'test'
3
- RUBYOPT="-w $RUBYOPT"
3
+ RUBYOPT = "-w $RUBYOPT".freeze
4
4
 
5
5
  if ENV["COVERAGE"]
6
6
  require 'coveralls'
@@ -13,16 +13,21 @@ if ENV["COVERAGE"]
13
13
  # https://github.com/colszowka/simplecov/pull/104
14
14
  add_group 'Merit', 'lib'
15
15
  add_group 'DummyApp', 'test/dummy'
16
+ add_filter 'lib/generators'
16
17
  add_filter 'test/dummy/config/initializers'
17
18
  end
18
19
  SimpleCov.start 'rubygem'
19
20
  end
20
21
 
21
- require File.expand_path('../dummy/config/environment.rb', __FILE__)
22
- require 'rails/test_help'
23
- require 'minitest/rails'
24
- require 'mocha/mini_test'
25
- require "orm/#{Merit.orm}"
22
+ if ARGV.include?("-api-only")
23
+ require File.expand_path("dummy/config/environment_api_only.rb", __dir__)
24
+ else
25
+ require File.expand_path("dummy/config/environment.rb", __dir__)
26
+ end
27
+
28
+ require "rails/test_help"
29
+ require "minitest/rails"
30
+ require "mocha/minitest"
26
31
 
27
32
  Rails.backtrace_cleaner.remove_silencers!
28
33
 
@@ -33,9 +38,3 @@ Capybara.default_selector = :css
33
38
 
34
39
  # Load support files
35
40
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
36
-
37
- Merit.orm = :active_record if Merit.orm.nil?
38
-
39
- def active_record_orm?
40
- Merit.orm == :active_record
41
- end