regressor 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/{generators/regressor/controller → controller}/callback/after_filter.rb +1 -1
- data/lib/{generators/regressor/controller → controller}/callback/around_filter.rb +1 -1
- data/lib/{generators/regressor/controller → controller}/callback/before_filter.rb +1 -1
- data/lib/controller/regression.rb +26 -0
- data/lib/{generators/regressor/controller → controller}/routing/rest/routes.rb +1 -1
- data/lib/{generators/regressor/controller → controller}/util.rb +0 -0
- data/lib/generators/regressor/controller_generator.rb +3 -3
- data/lib/generators/regressor/install_generator.rb +1 -1
- data/lib/generators/regressor/model_generator.rb +33 -8
- data/lib/generators/regressor/mongoid/model_generator.rb +46 -0
- data/lib/{generators/regressor/model → model/active_record}/database/column.rb +1 -1
- data/lib/{generators/regressor/model → model/active_record}/database/index.rb +4 -4
- data/lib/{generators/regressor/model → model/active_record}/enum.rb +2 -2
- data/lib/{generators/regressor/model → model/active_record}/nested/attribute.rb +1 -1
- data/lib/{generators/regressor/model → model/active_record}/relation/belong_to.rb +2 -2
- data/lib/{generators/regressor/model → model/active_record}/relation/has_many.rb +2 -2
- data/lib/{generators/regressor/model → model/active_record}/relation/has_one.rb +2 -2
- data/lib/{generators/regressor/model → model/active_record}/util.rb +0 -0
- data/lib/{generators/regressor/model → model/active_record}/validation/length.rb +2 -2
- data/lib/{generators/regressor/model → model/active_record}/validation/numericality.rb +3 -3
- data/lib/{generators/regressor/model → model/active_record}/validation/presence.rb +2 -2
- data/lib/model/active_record_model.rb +38 -0
- data/lib/model/mongoid/database/field.rb +21 -0
- data/lib/model/mongoid/relation/belongs_to.rb +15 -0
- data/lib/model/mongoid/relation/has_many.rb +15 -0
- data/lib/model/mongoid/relation/has_one.rb +15 -0
- data/lib/model/mongoid_model.rb +25 -0
- data/lib/regressor/version.rb +1 -1
- data/lib/{generators/templates → templates}/controller/controller_spec_template.erb +0 -0
- data/lib/{generators/templates/spec_regression_template.erb → templates/model/active_record/model_template.erb} +1 -1
- data/lib/templates/model/mongoid/model_template.erb +12 -0
- data/lib/{generators/templates → templates}/regressor.rb +0 -0
- metadata +58 -23
- data/lib/generators/regressor/regression_controller.rb +0 -23
- data/lib/generators/regressor/regression_model.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c0bdbd65abf40f27f951190ee43f692d3e93572
|
4
|
+
data.tar.gz: 41993247b6a11b5e5afe23d0afe9aa0c2dac4f15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e0b2d435ba8411eded5647c6826bf77211339d26f0e2e261a2c242f37ae3aeccad063d41958375fa54f16fcdf2b0da6c73dd8fb06c86843ae84e80b8d861a9d
|
7
|
+
data.tar.gz: 1f35f049b37b7ce4928200a12cc49518805ce9311b5223ddd9214f19e7ad9b04c686200cb0c4458e83f85660186e253aae7de34b844b8c336e12b8775377f6bf
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'controller/util'
|
2
|
+
require 'controller/routing/rest/routes'
|
3
|
+
require 'controller/callback/after_filter'
|
4
|
+
require 'controller/callback/before_filter'
|
5
|
+
require 'controller/callback/around_filter'
|
6
|
+
|
7
|
+
module Regressor
|
8
|
+
module Controller
|
9
|
+
class Regression
|
10
|
+
include Rails.application.routes.url_helpers
|
11
|
+
include ActionDispatch::Routing
|
12
|
+
|
13
|
+
include Util
|
14
|
+
include Routing::Rest::Routes
|
15
|
+
include Callback::BeforeFilter
|
16
|
+
include Callback::AfterFilter
|
17
|
+
include Callback::AroundFilter
|
18
|
+
|
19
|
+
attr_accessor :controller
|
20
|
+
|
21
|
+
def initialize(controller)
|
22
|
+
@controller = controller
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require 'controller/regression'
|
2
2
|
|
3
3
|
module Regressor
|
4
4
|
class ControllerGenerator < Rails::Generators::Base
|
@@ -7,8 +7,8 @@ module Regressor
|
|
7
7
|
def create_regression_files
|
8
8
|
Rails.application.eager_load!
|
9
9
|
ApplicationController.descendants.map(&:name).reject { |x| Regressor.configuration.excluded_controllers.include? x }.each do |controller|
|
10
|
-
@controller = Regressor::
|
11
|
-
create_file "#{Regressor.configuration.regression_controller_path}/#{controller.underscore}_spec.rb", ERB.new(File.new(File.expand_path('
|
10
|
+
@controller = Regressor::Controller::Regression.new(controller)
|
11
|
+
create_file "#{Regressor.configuration.regression_controller_path}/#{controller.underscore}_spec.rb", ERB.new(File.new(File.expand_path('../../templates/controller/controller_spec_template.erb', File.dirname(__FILE__))).read).result(binding)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -3,7 +3,7 @@ module Regressor
|
|
3
3
|
source_root(File.expand_path(File.dirname(__FILE__)))
|
4
4
|
|
5
5
|
def copy_initializer
|
6
|
-
copy_file '
|
6
|
+
copy_file '../../templates/regressor.rb', 'config/initializers/regressor.rb'
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
@@ -1,20 +1,45 @@
|
|
1
|
-
|
1
|
+
require 'model/active_record_model'
|
2
2
|
|
3
3
|
module Regressor
|
4
4
|
class ModelGenerator < Rails::Generators::Base
|
5
5
|
source_root(File.expand_path(File.dirname(__FILE__)))
|
6
6
|
|
7
7
|
def create_regression_files
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
load_application
|
9
|
+
generate_ar_specs
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def generate_ar_specs
|
15
|
+
load_ar_models.each do |model|
|
16
|
+
save_generate(model) do
|
17
|
+
@model = ::Regressor::Model::ActiveRecordModel.new(model)
|
18
|
+
create_file "#{Regressor.configuration.regression_path}/#{model.tableize.gsub("/", "_").singularize}_spec.rb",
|
19
|
+
ERB.new(File.new(File.expand_path('../../templates/model/active_record/model_template.erb', File.dirname(__FILE__))).read).result(binding)
|
15
20
|
end
|
16
21
|
end
|
17
22
|
end
|
18
23
|
|
24
|
+
def load_application
|
25
|
+
Rails.application.try(:eager_load!)
|
26
|
+
end
|
27
|
+
|
28
|
+
def load_ar_models
|
29
|
+
if defined?(::ActiveRecord::Base)
|
30
|
+
ActiveRecord::Base.descendants.map(&:name).reject { |x| Regressor.configuration.excluded_models.include? x }
|
31
|
+
else
|
32
|
+
[]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def save_generate(model)
|
37
|
+
begin
|
38
|
+
yield
|
39
|
+
rescue Exception => e
|
40
|
+
puts "Cannot create model regression for #{model}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
19
44
|
end
|
20
45
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'model/mongoid_model'
|
2
|
+
|
3
|
+
module Regressor
|
4
|
+
module Mongoid
|
5
|
+
class ModelGenerator < Rails::Generators::Base
|
6
|
+
source_root(File.expand_path(File.dirname(__FILE__)))
|
7
|
+
|
8
|
+
def create_regression_files
|
9
|
+
load_application
|
10
|
+
generate_mongoid_specs
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def generate_mongoid_specs
|
16
|
+
load_mongoid_models.each do |model|
|
17
|
+
save_generate(model) do
|
18
|
+
@model = ::Regressor::Model::MongoidModel.new(model)
|
19
|
+
create_file "#{Regressor.configuration.regression_path}/mongoid/#{model.name.tableize.singularize}_spec.rb",
|
20
|
+
ERB.new(File.new(File.expand_path('../../../templates/model/mongoid/model_template.erb', File.dirname(__FILE__))).read).result(binding)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def load_application
|
26
|
+
Rails.application.try(:eager_load!)
|
27
|
+
end
|
28
|
+
|
29
|
+
def load_mongoid_models
|
30
|
+
models = Object.constants.collect { |sym| Object.const_get(sym) }.
|
31
|
+
select { |constant| constant.class == Class && constant.include?(::Mongoid::Document) }
|
32
|
+
models << models.map(&:subclasses)
|
33
|
+
models.flatten.uniq.reject { |x| Regressor.configuration.excluded_models.include? x }
|
34
|
+
end
|
35
|
+
|
36
|
+
def save_generate(model)
|
37
|
+
begin
|
38
|
+
yield
|
39
|
+
rescue Exception => e
|
40
|
+
puts "Cannot create model regression for #{model}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -2,10 +2,10 @@ module Regressor
|
|
2
2
|
module Model
|
3
3
|
module Database
|
4
4
|
module Index
|
5
|
-
def
|
6
|
-
ActiveRecord::Base.connection.indexes(@model.tableize.gsub("/", "_")).map do |indexes|
|
7
|
-
"it { is_expected.to have_db_index #{indexes.columns}}"
|
8
|
-
end.flatten.join("\n
|
5
|
+
def indices
|
6
|
+
::ActiveRecord::Base.connection.indexes(@model.tableize.gsub("/", "_")).map do |indexes|
|
7
|
+
"it { is_expected.to have_db_index #{indexes.columns} }"
|
8
|
+
end.flatten.join("\n ")
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -7,9 +7,9 @@ module Regressor
|
|
7
7
|
enum_values = enum_v.map do |key, value|
|
8
8
|
key
|
9
9
|
end
|
10
|
-
enum_specs << "it { is_expected.to define_enum_for(:#{enum_k}).with(#{enum_values})}"
|
10
|
+
enum_specs << "it { is_expected.to define_enum_for(:#{enum_k}).with(#{enum_values}) }"
|
11
11
|
end
|
12
|
-
enum_specs.compact.uniq.join("\n
|
12
|
+
enum_specs.compact.uniq.join("\n ")
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -4,8 +4,8 @@ module Regressor
|
|
4
4
|
module BelongTo
|
5
5
|
def belong_to_relations
|
6
6
|
@model.constantize.reflect_on_all_associations(:belongs_to).map(&:name).map do |relation|
|
7
|
-
"it { is_expected.to belong_to :#{relation}}"
|
8
|
-
end.join("\n
|
7
|
+
"it { is_expected.to belong_to :#{relation} }"
|
8
|
+
end.join("\n ")
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -4,8 +4,8 @@ module Regressor
|
|
4
4
|
module HasMany
|
5
5
|
def has_many_relations
|
6
6
|
@model.constantize.reflect_on_all_associations(:has_many).map(&:name).map do |relation|
|
7
|
-
"it { is_expected.to have_many :#{relation}}"
|
8
|
-
end.join("\n
|
7
|
+
"it { is_expected.to have_many :#{relation} }"
|
8
|
+
end.join("\n ") rescue nil
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -4,8 +4,8 @@ module Regressor
|
|
4
4
|
module HasOne
|
5
5
|
def has_one_relations
|
6
6
|
@model.constantize.reflect_on_all_associations(:has_one).map(&:name).map do |relation|
|
7
|
-
"it { is_expected.to have_one :#{relation}}"
|
8
|
-
end.join("\n
|
7
|
+
"it { is_expected.to have_one :#{relation} }"
|
8
|
+
end.join("\n ") rescue nil
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
File without changes
|
@@ -3,11 +3,11 @@ module Regressor
|
|
3
3
|
module Validation
|
4
4
|
module Length
|
5
5
|
def length_validators
|
6
|
-
extract_validators(ActiveModel::Validations::LengthValidator).inject([]) do |result, validator|
|
6
|
+
extract_validators(::ActiveModel::Validations::LengthValidator).inject([]) do |result, validator|
|
7
7
|
result << generate_length_examples(validator, validator.options[:minimum]-1, validator.options[:minimum]) if validator.options[:minimum]
|
8
8
|
result << generate_length_examples(validator, validator.options[:maximum] + 1, validator.options[:maximum]) if validator.options[:maximum]
|
9
9
|
result
|
10
|
-
end.flatten.compact.uniq.join("\n
|
10
|
+
end.flatten.compact.uniq.join("\n ")
|
11
11
|
end
|
12
12
|
|
13
13
|
private
|
@@ -3,21 +3,21 @@ module Regressor
|
|
3
3
|
module Validation
|
4
4
|
module Numericality
|
5
5
|
def numericality_validators
|
6
|
-
extract_validators(ActiveModel::Validations::NumericalityValidator).inject([]) do |result, validator|
|
6
|
+
extract_validators(::ActiveModel::Validations::NumericalityValidator).inject([]) do |result, validator|
|
7
7
|
if validator.options.blank?
|
8
8
|
result += validator_without_options(validator)
|
9
9
|
else
|
10
10
|
result += validator_with_options(validator)
|
11
11
|
end
|
12
12
|
result
|
13
|
-
end.uniq.join("\n
|
13
|
+
end.uniq.join("\n ")
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
17
17
|
|
18
18
|
def validator_without_options(validator)
|
19
19
|
validator.attributes.map do |attribute|
|
20
|
-
"it { is_expected.to validate_numericality_of(:#{attribute})}"
|
20
|
+
"it { is_expected.to validate_numericality_of(:#{attribute}) }"
|
21
21
|
end.flatten
|
22
22
|
end
|
23
23
|
|
@@ -3,9 +3,9 @@ module Regressor
|
|
3
3
|
module Validation
|
4
4
|
module Presence
|
5
5
|
def presence_validators
|
6
|
-
extract_validators(ActiveRecord::Validations::PresenceValidator).map(&:attributes).flatten.map do |attribute|
|
6
|
+
extract_validators(::ActiveRecord::Validations::PresenceValidator).map(&:attributes).flatten.map do |attribute|
|
7
7
|
"it { is_expected.to validate_presence_of :#{attribute} }"
|
8
|
-
end.uniq.join("\n
|
8
|
+
end.uniq.join("\n ")
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require_relative 'active_record/util'
|
2
|
+
require_relative 'active_record/relation/belong_to'
|
3
|
+
require_relative 'active_record/relation/has_one'
|
4
|
+
require_relative 'active_record/relation/has_many'
|
5
|
+
require_relative 'active_record/validation/presence'
|
6
|
+
require_relative 'active_record/validation/length'
|
7
|
+
require_relative 'active_record/validation/numericality'
|
8
|
+
require_relative 'active_record/database/column'
|
9
|
+
require_relative 'active_record/database/index'
|
10
|
+
require_relative 'active_record/nested/attribute'
|
11
|
+
require_relative 'active_record/enum'
|
12
|
+
|
13
|
+
module Regressor
|
14
|
+
module Model
|
15
|
+
class ActiveRecordModel
|
16
|
+
# === Includes ===
|
17
|
+
include Relation::BelongTo
|
18
|
+
include Relation::HasOne
|
19
|
+
include Relation::HasMany
|
20
|
+
include Validation::Presence
|
21
|
+
include Validation::Length
|
22
|
+
include Validation::Numericality
|
23
|
+
include Database::Column
|
24
|
+
include Database::Index
|
25
|
+
include Nested::Attribute
|
26
|
+
include Enum
|
27
|
+
include Util
|
28
|
+
|
29
|
+
# === Attribute Accessors ===
|
30
|
+
attr_accessor :model
|
31
|
+
|
32
|
+
# === Methods ===
|
33
|
+
def initialize(model)
|
34
|
+
@model = model
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Regressor
|
2
|
+
module Model
|
3
|
+
module Mongoid
|
4
|
+
module Database
|
5
|
+
module Field
|
6
|
+
def fields
|
7
|
+
@model.fields.keys.map do |field|
|
8
|
+
"it { is_expected.to have_field(:#{field}).of_type(#{field_type(@model, field)}) }"
|
9
|
+
end.join("\n ")
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def field_type(model, field)
|
15
|
+
model.fields[field].type
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Regressor
|
2
|
+
module Model
|
3
|
+
module Mongoid
|
4
|
+
module Relation
|
5
|
+
module BelongsTo
|
6
|
+
def belongs_to_relations
|
7
|
+
@model.reflect_on_all_associations(:belongs_to).map(&:name).map do |relation|
|
8
|
+
"it { is_expected.to belong_to :#{relation} }"
|
9
|
+
end.join("\n ")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Regressor
|
2
|
+
module Model
|
3
|
+
module Mongoid
|
4
|
+
module Relation
|
5
|
+
module HasMany
|
6
|
+
def has_many_relations
|
7
|
+
@model.reflect_on_all_associations(:has_many).map(&:name).map do |relation|
|
8
|
+
"it { is_expected.to have_many :#{relation} }"
|
9
|
+
end.join("\n ")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Regressor
|
2
|
+
module Model
|
3
|
+
module Mongoid
|
4
|
+
module Relation
|
5
|
+
module HasOne
|
6
|
+
def has_one_relations
|
7
|
+
@model.reflect_on_all_associations(:has_one).map(&:name).map do |relation|
|
8
|
+
"it { is_expected.to have_one :#{relation} }"
|
9
|
+
end.join("\n ")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'model/mongoid/database/field'
|
2
|
+
require 'model/mongoid/relation/has_many'
|
3
|
+
require 'model/mongoid/relation/has_one'
|
4
|
+
require 'model/mongoid/relation/belongs_to'
|
5
|
+
|
6
|
+
module Regressor
|
7
|
+
module Model
|
8
|
+
class MongoidModel
|
9
|
+
# === Includes ===
|
10
|
+
include Mongoid::Database::Field
|
11
|
+
include Mongoid::Relation::HasMany
|
12
|
+
include Mongoid::Relation::HasOne
|
13
|
+
include Mongoid::Relation::BelongsTo
|
14
|
+
|
15
|
+
# === Attribute Accessors ===
|
16
|
+
attr_accessor :model
|
17
|
+
|
18
|
+
# === Methods ===
|
19
|
+
def initialize(model)
|
20
|
+
@model = model
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/regressor/version.rb
CHANGED
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe <%= @model.model %>, regressor: true do
|
4
|
+
|
5
|
+
# === Relations ===
|
6
|
+
<%= @model.belongs_to_relations %>
|
7
|
+
<%= @model.has_one_relations %>
|
8
|
+
<%= @model.has_many_relations %>
|
9
|
+
|
10
|
+
# === Database (Fields) ===
|
11
|
+
<%= @model.fields %>
|
12
|
+
end
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: regressor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erwin Schens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shoulda-matchers
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '4.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mongoid-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.1.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.1.0
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: sqlite3
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +108,20 @@ dependencies:
|
|
94
108
|
- - ">="
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: mongoid
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 4.0.2
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 4.0.2
|
97
125
|
description: Regressor generates regression specs based on ActiveRecord models. Currently
|
98
126
|
relations, validations, attributes, and database indexes are supported.
|
99
127
|
email:
|
@@ -104,32 +132,39 @@ extra_rdoc_files: []
|
|
104
132
|
files:
|
105
133
|
- MIT-LICENSE
|
106
134
|
- Rakefile
|
107
|
-
- lib/
|
108
|
-
- lib/
|
109
|
-
- lib/
|
110
|
-
- lib/
|
111
|
-
- lib/
|
135
|
+
- lib/controller/callback/after_filter.rb
|
136
|
+
- lib/controller/callback/around_filter.rb
|
137
|
+
- lib/controller/callback/before_filter.rb
|
138
|
+
- lib/controller/regression.rb
|
139
|
+
- lib/controller/routing/rest/routes.rb
|
140
|
+
- lib/controller/util.rb
|
112
141
|
- lib/generators/regressor/controller_generator.rb
|
113
142
|
- lib/generators/regressor/install_generator.rb
|
114
|
-
- lib/generators/regressor/model/database/column.rb
|
115
|
-
- lib/generators/regressor/model/database/index.rb
|
116
|
-
- lib/generators/regressor/model/enum.rb
|
117
|
-
- lib/generators/regressor/model/nested/attribute.rb
|
118
|
-
- lib/generators/regressor/model/relation/belong_to.rb
|
119
|
-
- lib/generators/regressor/model/relation/has_many.rb
|
120
|
-
- lib/generators/regressor/model/relation/has_one.rb
|
121
|
-
- lib/generators/regressor/model/util.rb
|
122
|
-
- lib/generators/regressor/model/validation/length.rb
|
123
|
-
- lib/generators/regressor/model/validation/numericality.rb
|
124
|
-
- lib/generators/regressor/model/validation/presence.rb
|
125
143
|
- lib/generators/regressor/model_generator.rb
|
126
|
-
- lib/generators/regressor/
|
127
|
-
- lib/
|
128
|
-
- lib/
|
129
|
-
- lib/
|
130
|
-
- lib/
|
144
|
+
- lib/generators/regressor/mongoid/model_generator.rb
|
145
|
+
- lib/model/active_record/database/column.rb
|
146
|
+
- lib/model/active_record/database/index.rb
|
147
|
+
- lib/model/active_record/enum.rb
|
148
|
+
- lib/model/active_record/nested/attribute.rb
|
149
|
+
- lib/model/active_record/relation/belong_to.rb
|
150
|
+
- lib/model/active_record/relation/has_many.rb
|
151
|
+
- lib/model/active_record/relation/has_one.rb
|
152
|
+
- lib/model/active_record/util.rb
|
153
|
+
- lib/model/active_record/validation/length.rb
|
154
|
+
- lib/model/active_record/validation/numericality.rb
|
155
|
+
- lib/model/active_record/validation/presence.rb
|
156
|
+
- lib/model/active_record_model.rb
|
157
|
+
- lib/model/mongoid/database/field.rb
|
158
|
+
- lib/model/mongoid/relation/belongs_to.rb
|
159
|
+
- lib/model/mongoid/relation/has_many.rb
|
160
|
+
- lib/model/mongoid/relation/has_one.rb
|
161
|
+
- lib/model/mongoid_model.rb
|
131
162
|
- lib/regressor.rb
|
132
163
|
- lib/regressor/version.rb
|
164
|
+
- lib/templates/controller/controller_spec_template.erb
|
165
|
+
- lib/templates/model/active_record/model_template.erb
|
166
|
+
- lib/templates/model/mongoid/model_template.erb
|
167
|
+
- lib/templates/regressor.rb
|
133
168
|
homepage: https://github.com/ndea/regressor
|
134
169
|
licenses:
|
135
170
|
- MIT
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require_relative '../../../lib/generators/regressor/controller/util'
|
2
|
-
require_relative '../../../lib/generators/regressor/controller/routing/rest/routes'
|
3
|
-
require_relative '../../../lib/generators/regressor/controller/callback/before_filter'
|
4
|
-
require_relative '../../../lib/generators/regressor/controller/callback/after_filter'
|
5
|
-
require_relative '../../../lib/generators/regressor/controller/callback/around_filter'
|
6
|
-
|
7
|
-
class Regressor::RegressionController
|
8
|
-
include Rails.application.routes.url_helpers
|
9
|
-
include ActionDispatch::Routing
|
10
|
-
|
11
|
-
include Regressor::Controller::Util
|
12
|
-
include Regressor::Controller::Routing::Rest::Routes
|
13
|
-
include Regressor::Controller::Callback::BeforeFilter
|
14
|
-
include Regressor::Controller::Callback::AfterFilter
|
15
|
-
include Regressor::Controller::Callback::AroundFilter
|
16
|
-
|
17
|
-
attr_accessor :controller
|
18
|
-
|
19
|
-
def initialize(controller)
|
20
|
-
@controller = controller
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require_relative 'model/util'
|
2
|
-
require_relative 'model/relation/belong_to'
|
3
|
-
require_relative 'model/relation/has_one'
|
4
|
-
require_relative 'model/relation/has_many'
|
5
|
-
require_relative 'model/validation/presence'
|
6
|
-
require_relative 'model/validation/length'
|
7
|
-
require_relative 'model/validation/numericality'
|
8
|
-
require_relative 'model/database/column'
|
9
|
-
require_relative 'model/database/index'
|
10
|
-
require_relative 'model/nested/attribute'
|
11
|
-
require_relative 'model/enum'
|
12
|
-
|
13
|
-
class Regressor::RegressionModel
|
14
|
-
include Regressor::Model::Relation::BelongTo
|
15
|
-
include Regressor::Model::Relation::HasOne
|
16
|
-
include Regressor::Model::Relation::HasMany
|
17
|
-
include Regressor::Model::Validation::Presence
|
18
|
-
include Regressor::Model::Validation::Length
|
19
|
-
include Regressor::Model::Validation::Numericality
|
20
|
-
include Regressor::Model::Database::Column
|
21
|
-
include Regressor::Model::Database::Index
|
22
|
-
include Regressor::Model::Nested::Attribute
|
23
|
-
include Regressor::Model::Enum
|
24
|
-
include Regressor::Model::Util
|
25
|
-
|
26
|
-
attr_accessor :model
|
27
|
-
|
28
|
-
def initialize(model)
|
29
|
-
@model = model
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|