eitil 2.0.1 → 2.0.5

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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -1
  3. data/eitil_integrate/lib/eitil_integrate/application_exporter.rb +0 -1
  4. data/lib/eitil/railtie.rb +2 -3
  5. data/lib/eitil/version.rb +1 -1
  6. data/spec/dummy_app/app/models/user.rb +0 -25
  7. data/spec/spec_helper.rb +0 -2
  8. metadata +2 -25
  9. data/eitil_integrate/lib/eitil_integrate/application_exporter/lookups.rb +0 -50
  10. data/eitil_wrapper/README.md +0 -271
  11. data/eitil_wrapper/lib/eitil_wrapper/callbacks/helper_methods.rb +0 -118
  12. data/eitil_wrapper/lib/eitil_wrapper/callbacks.rb +0 -2
  13. data/eitil_wrapper/lib/eitil_wrapper/jobs/new_job.rb +0 -34
  14. data/eitil_wrapper/lib/eitil_wrapper/jobs/new_job_now.rb +0 -37
  15. data/eitil_wrapper/lib/eitil_wrapper/jobs/single_method_job.rb +0 -11
  16. data/eitil_wrapper/lib/eitil_wrapper/jobs.rb +0 -4
  17. data/eitil_wrapper/lib/eitil_wrapper/railtie.rb +0 -94
  18. data/eitil_wrapper/lib/eitil_wrapper/records/default_calculators.rb +0 -104
  19. data/eitil_wrapper/lib/eitil_wrapper/records/default_scopes.rb +0 -95
  20. data/eitil_wrapper/lib/eitil_wrapper/records/default_sorts.rb +0 -81
  21. data/eitil_wrapper/lib/eitil_wrapper/records.rb +0 -4
  22. data/eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb +0 -48
  23. data/eitil_wrapper/lib/eitil_wrapper/request_logger/logger_job.rb +0 -17
  24. data/eitil_wrapper/lib/eitil_wrapper/request_logger.rb +0 -5
  25. data/eitil_wrapper/lib/eitil_wrapper/routes/extended_resources.rb +0 -40
  26. data/eitil_wrapper/lib/eitil_wrapper/routes.rb +0 -2
  27. data/eitil_wrapper/lib/eitil_wrapper.rb +0 -8
  28. data/spec/eitil_wrapper/callbacks/helper_methods_spec.rb +0 -34
  29. data/spec/eitil_wrapper/jobs/single_method_job_spec.rb +0 -72
  30. data/spec/eitil_wrapper/routes/extended_resources_spec.rb +0 -16
  31. data/spec/eitil_wrapper/scopes/default_scopes_spec.rb +0 -154
@@ -1,11 +0,0 @@
1
- # ISSUE: this code is currently defined eitil_wrapper/railtie.rb, since module inclusion
2
- # somehow leads to errors in the initialization process. Ideally, this code would be
3
- # defined in eitil_wrapper/jobs/single_method_job.rb and dispatched in eitil_wrapper/railtie.rb
4
-
5
- # require "eitil_wrapper/railtie" to run the dynamic dispatch as an init hook during boot
6
- require "eitil_wrapper/railtie"
7
-
8
- module EitilWrapper
9
- module CreateSingleMethodJob
10
- end
11
- end
@@ -1,4 +0,0 @@
1
-
2
- require "eitil_wrapper/jobs/new_job"
3
- require "eitil_wrapper/jobs/new_job_now"
4
- require "eitil_wrapper/jobs/single_method_job"
@@ -1,94 +0,0 @@
1
-
2
- module EitilWrapper
3
-
4
- class Railtie < Rails::Railtie
5
-
6
- # Dynamic dispatching after initialization of Rails classes.
7
-
8
- initializer "my_railtie.configure_rails_initialization", options: :after do |app|
9
-
10
- if Object.const_defined?('EitilWrapper::Records::DefaultCalculators')
11
- ::ApplicationRecord.send(:extend, EitilWrapper::Records::DefaultCalculators)
12
- end
13
-
14
- if Object.const_defined?('EitilWrapper::Records::DefaultScopes')
15
- ::ApplicationRecord.send(:extend, EitilWrapper::Records::DefaultScopes)
16
- end
17
-
18
- if Object.const_defined?('EitilWrapper::Records::DefaultSorts')
19
- ::ApplicationRecord.send(:extend, EitilWrapper::Records::DefaultSorts)
20
- end
21
-
22
- if Object.const_defined?('EitilWrapper::Callbacks::HelperMethods')
23
- ::ApplicationRecord.send(:extend, EitilWrapper::Callbacks::HelperMethods)
24
- end
25
-
26
- if Object.const_defined?('EitilWrapper::CreateSingleMethodJob')
27
-
28
- # ISSUE: this code is currently defined eitil_wrapper/railtie.rb, since module inclusion
29
- # somehow leads to errors in the initialization process. Ideally, this code would be
30
- # defined in eitil_wrapper/jobs/single_method_job.rb and dispatched in eitil_wrapper/railtie.rb
31
-
32
- # BEWARE: _self is currently not accepted in perform_later jobs due to serialization errors
33
-
34
- # BEWARE: The cases of 'id' and '_self' both handle instances, with the difference
35
- # being that 'id' works for objects that have a database record, while '_self'
36
- # works for non database supported instanes, such as an Exporter instance.
37
-
38
- module ::EitilWrapper
39
-
40
- class ::ApplicationJob < ActiveJob::Base
41
- end
42
-
43
- class SingleMethodJob < ::ApplicationJob
44
- def perform(*args, _class:, _method:, id: nil, _self: nil, **kwargs)
45
- object =
46
- if id
47
- _class.constantize.find(id)
48
- elsif _self
49
- _self
50
- else
51
- _class.constantize
52
- end
53
-
54
- if args.present? and kwargs.present?
55
- object.send _method, *args, **kwargs
56
-
57
- elsif args.present?
58
- object.send _method, *args
59
-
60
- elsif kwargs.present?
61
- object.send _method, **kwargs
62
-
63
- else
64
- object.send _method
65
- end
66
-
67
- end; end; end; end
68
-
69
-
70
- if Object.const_defined?('EitilWrapper::RequestLogger::CreateLoggerJob')
71
-
72
- module ::EitilWrapper
73
- module RequestLogger
74
- class LoggerJob < ::ApplicationJob
75
-
76
- def perform(logger_object)
77
-
78
- # set path for logger
79
- $request_logger_path ||= "#{Rails.root}/log/request_logger.log"
80
-
81
- # create logger, if not present
82
- if Dir[$request_logger_path].blank? || $request_logger.blank?
83
- $request_logger = Logger.new($request_logger_path)
84
- end
85
-
86
- # add logger_object to logger
87
- $request_logger.info(logger_object)
88
-
89
- end; end; end; end; end
90
-
91
- end
92
-
93
- end
94
- end
@@ -1,104 +0,0 @@
1
-
2
- # require "eitil_wrapper/records/default_calculators"
3
-
4
- # require "eitil_wrapper/railtie" to run the dynamic dispatch as an init hook during boot
5
- require "eitil_wrapper/railtie"
6
-
7
- module EitilWrapper
8
- module Records
9
- module DefaultCalculators
10
-
11
- Eitil::ApplicationRecordModules << self
12
-
13
- SharableNumberCalculators = -> (_class, column) {
14
- _class.eitil_calculator :"#{column}_max", -> { _class.maximum(column) }
15
- _class.eitil_calculator :"#{column}_min", -> { _class.minimum(column) }
16
- _class.eitil_calculator :"#{column}_sum", -> { _class.sum(column) }
17
- _class.eitil_calculator :"#{column}_avg", -> { _class.average(column) }
18
- }
19
-
20
- SharableIterableCalculators = -> (_class, column) {
21
- _class.eitil_calculator :"#{column}_sum", -> { _class.pluck(column).flatten!.uniq }
22
- _class.eitil_calculator :"#{column}_sum_i", -> { _class.pluck(column).flatten!.uniq.map(&:to_i) }
23
- _class.eitil_calculator :"#{column}_sum_f", -> { _class.pluck(column).flatten!.uniq.map(&:to_f) }
24
- _class.eitil_calculator :"#{column}_sum_d", -> { _class.pluck(column).flatten!.uniq.map(&:to_d) }
25
- }
26
-
27
- def inherited(subclass)
28
- super
29
- return if Eitil.skip_default_calculators_for_models.include?(subclass.to_s.to_sym)
30
-
31
- # Set the proper table_names for namespaced models. Without setting this,
32
- # Rails run into problems due to the fact that the first call to the model's
33
- # constant triggers this initializer first, and only thereafter the model file
34
- # which sets the correct table_name through a macro.
35
-
36
- namespaced_class = subclass.to_s.include?('::')
37
- subclass.table_name = subclass.to_s.gsub('::', '_').downcase.pluralize if namespaced_class
38
-
39
- subclass.use_eitil_calculators
40
-
41
- rescue => e
42
- puts "default calculators failed for class '#{subclass}' with expected table '#{subclass.table_name}' because of #{e.class} and '#{e.to_s.split(' ').first}'"
43
- end
44
-
45
- def use_eitil_calculators
46
- return if abstract_class?
47
-
48
- # text[] is postgresql's datatype for serialized arrays
49
- # numeric is postgresql's datatype for decimals
50
- # double precision is postgresql's datatype for floats
51
-
52
-
53
- %w[integer bigint double\ precision numeric].each do |_type|
54
- send :"create_eitil_#{_type.gsub(' ','_')}_calculators"
55
- end
56
-
57
- create_array_calculators
58
- end
59
-
60
- def eitil_calculator(_name, _proc)
61
- # skip calculator methods for primary and foreign key columns
62
- return if _name.to_s =~ /^id_[a-z]{1,}$/ || _name.to_s =~ /_id_[a-z]{1,}$/
63
-
64
- define_singleton_method(_name) { _proc.call } unless respond_to? _name
65
- end
66
-
67
- def calculator_columns_of_type(data_type)
68
- columns_hash.select { |column,v| v.sql_type == data_type }
69
- end
70
-
71
- def create_eitil_integer_calculators
72
- calculator_columns_of_type("integer")&.map do |column, object|
73
- SharableNumberCalculators.call self, column
74
- end
75
- end
76
-
77
- def create_eitil_bigint_calculators
78
- calculator_columns_of_type("bigint")&.map do |column, object|
79
- SharableNumberCalculators.call self, column
80
- end
81
- end
82
-
83
- def create_eitil_double_precision_calculators
84
- calculator_columns_of_type("double\ precision")&.map do |column, object|
85
- SharableNumberCalculators.call self, column
86
- end
87
- end
88
-
89
- def create_eitil_numeric_calculators
90
- calculator_columns_of_type("numeric")&.map do |column, object|
91
- SharableNumberCalculators.call self, column
92
- end
93
- end
94
-
95
- def create_array_calculators
96
- columns = columns_hash.select { |column,v| v.sql_type == "text" && v.default == "{}" }
97
- columns&.map do |column, object|
98
- SharableIterableCalculators.call self, column
99
- end
100
- end
101
-
102
- end
103
- end
104
- end
@@ -1,95 +0,0 @@
1
-
2
- # require "eitil_wrapper/records/default_scopes"
3
-
4
- # require "eitil_wrapper/railtie" to run the dynamic dispatch as an init hook during boot
5
- require "eitil_wrapper/railtie"
6
-
7
- module EitilWrapper
8
- module Records
9
- module DefaultScopes
10
-
11
- Eitil::ApplicationRecordModules << self
12
-
13
- SharableDateScopes = -> (_class, column) {
14
- _class.eitil_scope :"#{column}_today", -> { where("#{column} = ?", Date.today) }
15
- _class.eitil_scope :"#{column}_past", -> { where("#{column} < ?", Date.today) }
16
- _class.eitil_scope :"#{column}_future", -> { where("#{column} > ?", Date.today) }
17
-
18
- _class.eitil_scope :"#{column}_on_date", -> (date) { where("#{column} = ?", date) }
19
- _class.eitil_scope :"#{column}_before_date", -> (date) { where("#{column} = ?", date) }
20
- _class.eitil_scope :"#{column}_after_date", -> (date) { where("#{column} = ?", date) }
21
- _class.eitil_scope :"#{column}_between_dates", -> (from, till) { where("#{column} >= ? and #{column} <= ?", from, till) }
22
- }
23
-
24
- SharableNumScopes = -> (_class, column) {
25
- _class.eitil_scope :"#{column}_equal_to", -> (number) { where("#{column} = ?", number) }
26
- _class.eitil_scope :"#{column}_lower_than", -> (number) { where("#{column} = <", number) }
27
- _class.eitil_scope :"#{column}_higher_than", -> (number) { where("#{column} = >", number) }
28
- _class.eitil_scope :"#{column}_between", -> (min, max) { where("#{column} >= ? and #{column} <= ?", min, max) }
29
- }
30
-
31
- def inherited(subclass)
32
- super
33
- return if Eitil.skip_default_scopes_for_models.include?(subclass.to_s.to_sym)
34
-
35
- # Set the proper table_names for namespaced models. Without setting this,
36
- # Rails run into problems due to the fact that the first call to the model's
37
- # constant triggers this initializer first, and only thereafter the model file
38
- # which sets the correct table_name through a macro.
39
-
40
- namespaced_class = subclass.to_s.include?('::')
41
- subclass.table_name = subclass.to_s.gsub('::', '_').downcase.pluralize if namespaced_class
42
-
43
- subclass.use_eitil_scopes
44
-
45
- rescue => e
46
- puts "default scopes failed for class '#{subclass}' with expected table '#{subclass.table_name}' because of #{e.class} and '#{e.to_s.split(' ').first}'"
47
- end
48
-
49
- def use_eitil_scopes
50
- return if abstract_class?
51
- %i[boolean datetime date integer float].each { |_type| send :"create_eitil_#{_type}_scopes" }
52
- end
53
-
54
- def eitil_scope(_name, _proc)
55
- scope _name, _proc unless respond_to? _name
56
- end
57
-
58
- def columns_of_type(data_type)
59
- columns_hash.select { |column,v| v.sql_type_metadata.type == data_type }
60
- end
61
-
62
- def create_eitil_boolean_scopes
63
- columns_of_type(:boolean)&.map do |column, object|
64
- eitil_scope :"#{column}_true", -> { where(column => true) }
65
- eitil_scope :"#{column}_false", -> { where(column => [false, nil]) }
66
- end
67
- end
68
-
69
- def create_eitil_datetime_scopes
70
- columns_of_type(:datetime)&.map do |column, object|
71
- SharableDateScopes.call self, column
72
- end
73
- end
74
-
75
- def create_eitil_date_scopes
76
- columns_of_type(:date)&.map do |column, object|
77
- SharableDateScopes.call self, column
78
- end
79
- end
80
-
81
- def create_eitil_integer_scopes
82
- columns_of_type(:integer)&.map do |column, object|
83
- SharableNumScopes.call self, column
84
- end
85
- end
86
-
87
- def create_eitil_float_scopes
88
- columns_of_type(:float)&.map do |column, object|
89
- SharableNumScopes.call self, column
90
- end
91
- end
92
-
93
- end
94
- end
95
- end
@@ -1,81 +0,0 @@
1
-
2
- # require "eitil_wrapper/records/default_sorts"
3
-
4
- # require "eitil_wrapper/railtie" to run the dynamic dispatch as an init hook during boot
5
- require "eitil_wrapper/railtie"
6
-
7
-
8
- module EitilWrapper
9
- module Records
10
- module DefaultSorts
11
-
12
- Eitil::ApplicationRecordModules << self
13
-
14
- SharableDateSorts = -> (_class, column) {
15
- _class.eitil_sort :"#{column}_oldest_first", -> { _class.order("#{column} ASC") }
16
- _class.eitil_sort :"#{column}_newest_first", -> { _class.order("#{column} DESC") }
17
- }
18
-
19
- SharableNumSorts = -> (_class, column) {
20
- _class.eitil_sort :"#{column}_ascending", -> { _class.order("#{column} ASC") }
21
- _class.eitil_sort :"#{column}_descending", -> { _class.order("#{column} DESC") }
22
- }
23
-
24
- def inherited(subclass)
25
- super
26
- return if Eitil.skip_default_sorts_for_models.include?(subclass.to_s.to_sym)
27
-
28
- # Set the proper table_names for namespaced models. Without setting this,
29
- # Rails run into problems due to the fact that the first call to the model's
30
- # constant triggers this initializer first, and only thereafter the model file
31
- # which sets the correct table_name through a macro.
32
-
33
- namespaced_class = subclass.to_s.include?('::')
34
- subclass.table_name = subclass.to_s.gsub('::', '_').downcase.pluralize if namespaced_class
35
-
36
- subclass.use_eitil_sorts
37
-
38
- rescue => e
39
- puts "default sorts failed for class '#{subclass}' with expected table '#{subclass.table_name}' because of #{e.class} and '#{e.to_s.split(' ').first}'"
40
- end
41
-
42
- def use_eitil_sorts
43
- return if abstract_class?
44
- %i[datetime date integer float].each { |_type| send :"create_eitil_#{_type}_sorts" }
45
- end
46
-
47
- def eitil_sort(_name, _proc)
48
- define_singleton_method(_name) { _proc.call } unless respond_to? _name
49
- end
50
-
51
- def sort_columns_of_type(data_type)
52
- columns_hash.select { |column,v| v.sql_type_metadata.type == data_type }
53
- end
54
-
55
- def create_eitil_datetime_sorts
56
- columns_of_type(:datetime)&.map do |column, object|
57
- SharableDateSorts.call self, column
58
- end
59
- end
60
-
61
- def create_eitil_date_sorts
62
- columns_of_type(:date)&.map do |column, object|
63
- SharableDateSorts.call self, column
64
- end
65
- end
66
-
67
- def create_eitil_integer_sorts
68
- columns_of_type(:integer)&.map do |column, object|
69
- SharableNumSorts.call self, column
70
- end
71
- end
72
-
73
- def create_eitil_float_sorts
74
- columns_of_type(:float)&.map do |column, object|
75
- SharableNumSorts.call self, column
76
- end
77
- end
78
-
79
- end
80
- end
81
- end
@@ -1,4 +0,0 @@
1
-
2
- require "eitil_wrapper/records/default_scopes"
3
- require "eitil_wrapper/records/default_calculators"
4
- require "eitil_wrapper/records/default_sorts"
@@ -1,48 +0,0 @@
1
-
2
- # require "eitil_wrapper/request_logger/controller_mixin"
3
-
4
- require_relative "logger_job"
5
-
6
- module EitilWrapper
7
- module RequestLogger
8
- module ControllerMixin
9
-
10
- private
11
-
12
- def log_request
13
- $request_logger_path ||= "#{Rails.root}/log/request_logger.log"
14
- EitilWrapper::RequestLogger::LoggerJob.perform_later(request_logger_object)
15
- end
16
-
17
- def request_logger_object
18
-
19
- log_request = {
20
- path: request.env["REQUEST_PATH"],
21
- method: request.env["REQUEST_METHOD"],
22
- query_str: request.env["QUERY_STRING"],
23
- }
24
-
25
- log_params = {
26
- params: params.as_json
27
- }
28
-
29
- log_attributes = {
30
- time: Time.now.strftime("%Y-%m-%d %H:%M:%S")
31
- }
32
-
33
- log = {
34
- request: log_request,
35
- params: log_params,
36
- attributes: log_attributes
37
- }
38
-
39
- log_time = log_attributes[:time]
40
- log_strf = log.deep_symbolize_keys.to_s
41
- # log_strf may be hashed through eval(log_strf)
42
-
43
- return log_strf
44
- end
45
-
46
- end
47
- end
48
- end
@@ -1,17 +0,0 @@
1
-
2
- # require "eitil_wrapper/request_logger/logger_job"
3
-
4
- # require "eitil_wrapper/railtie" to run the dynamic dispatch as an init hook during boot
5
- require "eitil_wrapper/railtie"
6
-
7
- # ISSUE: this code is currently defined eitil_wrapper/railtie.rb, since module inclusion
8
- # somehow leads to errors in the initialization process. Ideally, this code would be
9
- # defined in eitil_wrapper/request_logger/logger_job.rb and dispatched in eitil_wrapper/railtie.rb
10
-
11
- module EitilWrapper
12
- module RequestLogger
13
- module CreateLoggerJob
14
-
15
- end
16
- end
17
- end
@@ -1,5 +0,0 @@
1
-
2
- # require "eitil_wrapper/request_logger"
3
-
4
- require_relative "request_logger/controller_mixin"
5
- require_relative "request_logger/logger_job"
@@ -1,40 +0,0 @@
1
- module EitilWrapper
2
- module ExtendedResources
3
-
4
- RESOURCEFUL_ACTIONS = %i$ index new create show edit update destroy $
5
-
6
- private
7
-
8
- def extended_resources(controller, **kwargs)
9
- all_args_to_ivars binding
10
-
11
- resources(controller, **resource_args) do
12
- extended_routes&.each { |route| send(route).call controller }
13
- yield if block_given?
14
- end
15
- end
16
-
17
- def resource_args
18
- duplicate = @kwargs.dup
19
- duplicate[:only] = resourceful_routes
20
- duplicate
21
- end
22
-
23
- def resourceful_routes
24
- @kwargs.dig(:only) - extended_routes
25
- end
26
-
27
- def extended_routes
28
- @kwargs.dig(:only) - RESOURCEFUL_ACTIONS
29
- end
30
-
31
- def new_route(verb, _method, action, scope)
32
- self.class.send :define_method, _method do
33
- -> (controller) { send(verb, _method, to: "#{controller}##{action}", on: scope) }
34
- end
35
- end
36
-
37
- end
38
- end
39
-
40
- ActionDispatch::Routing::Mapper.__send__ :include, EitilWrapper::ExtendedResources
@@ -1,2 +0,0 @@
1
-
2
- require "eitil_wrapper/routes/extended_resources"
@@ -1,8 +0,0 @@
1
-
2
- require "eitil_wrapper"
3
-
4
- require "eitil_wrapper/jobs"
5
- require "eitil_wrapper/records"
6
- require "eitil_wrapper/routes"
7
- require "eitil_wrapper/callbacks"
8
- require "eitil_wrapper/request_logger"
@@ -1,34 +0,0 @@
1
-
2
- RSpec.describe "EitilWrapper::Callbacks" do
3
-
4
- let(:callbacks) { User.instance_methods(false) }
5
-
6
- context "for columns of datatype: boolean" do
7
-
8
- it "should create the callback .{column_name}_became_true" do
9
- expect(callbacks).to include(:confirmed_became_true)
10
- end
11
-
12
- it "should create the callback .{column_name}_becomes_true" do
13
- expect(callbacks).to include(:confirmed_becomes_true)
14
- end
15
-
16
- it "should create the callback .{column_name}_to_true (works for both become and became)" do
17
- expect(callbacks).to include(:confirmed_to_true)
18
- end
19
-
20
- it "should create the callback .{column_name}_became_false" do
21
- expect(callbacks).to include(:confirmed_became_false)
22
- end
23
-
24
- it "should create the callback .{column_name}_becomes_false" do
25
- expect(callbacks).to include(:confirmed_becomes_false)
26
- end
27
-
28
- it "should create the callback .{column_name}_to_false (works for both become and became)" do
29
- expect(callbacks).to include(:confirmed_to_false)
30
- end
31
-
32
- end
33
-
34
- end
@@ -1,72 +0,0 @@
1
-
2
- RSpec.describe "EitilWrapper::Jobs" do
3
-
4
- let(:user) { User.create(first_name: "Donald", last_name: "Duck") }
5
-
6
- it "should create a new method, if the new_job (perform_later) is used for a singleton method" do
7
- expect(User.methods).to include(:this_is_a_singleton_method_job)
8
- end
9
-
10
- it "should create a new method, if the new_job (perform_later) is used for an instance method" do
11
- expect(User.instance_methods).to include(:this_is_an_instance_method_job)
12
- end
13
-
14
- it "should create a new method, if the new_job_now (perform_now) is used for a singleton method" do
15
- expect(User.methods).to include(:this_is_a_singleton_method_job_now)
16
- end
17
-
18
- it "should create a new method, if the new_job_now (perform_now) is used for an instance method" do
19
- expect(User.instance_methods).to include(:this_is_an_instance_method_job_now)
20
- end
21
-
22
- it "should allow us to perform the created singleton perform_later method" do
23
- begin
24
- User.this_is_a_singleton_method_job
25
- status = 'passed'
26
- rescue
27
- status = 'failed'
28
- end
29
- expect(status).to eq 'passed'
30
- end
31
-
32
- it "should allow us to perform the created instance perform_later method" do
33
- begin
34
- user.this_is_an_instance_method_job
35
- status = 'passed'
36
- rescue
37
- status = 'failed'
38
- end
39
- expect(status).to eq 'passed'
40
- end
41
-
42
- it "should allow us to perform the created singleton perform_now method" do
43
- begin
44
- User.this_is_a_singleton_method_job_now
45
- status = 'passed'
46
- rescue
47
- status = 'failed'
48
- end
49
- expect(status).to eq 'passed'
50
- end
51
-
52
- it "should allow us to perform the created instance perform_now method" do
53
- begin
54
- user.this_is_an_instance_method_job_now
55
- status = 'passed'
56
- rescue
57
- status = 'failed'
58
- end
59
- expect(status).to eq 'passed'
60
- end
61
-
62
- it "should accept positional arguments" do
63
- return_value = User.this_is_a_singleton_method_job_now("positional_argument")
64
- expect(return_value).to eq "positional_argument"
65
- end
66
-
67
- it "should accept keyword arguments " do
68
- return_value = User.this_is_a_singleton_method_job_now(keyword_value: "keyword_argument")
69
- expect(return_value).to eq "keyword_argument"
70
- end
71
-
72
- end
@@ -1,16 +0,0 @@
1
-
2
- # NOT YET IMPLEMENTED, SINCE THIS PART OF EITIL IS NOT YET IN USE.
3
- # FIRST HOOK UP INTO EITJE_API, SINCE THAT MAY CHANGE THE FUNCTIONALITY.
4
-
5
- # RSpec.describe "EitilWrapper::Routes" do
6
-
7
- # before do
8
- # @pretty_routes = `cd spec/dummy_app && rails routes`
9
- # @routes = @pretty_routes.gsub(/[ \t]+/, ' ')
10
- # end
11
-
12
- # it "should " do
13
- # expect(@routes).to include('POST /users(.:format) users#create')
14
- # end
15
-
16
- # end