Comments (4)
I checked if I am testing that version of Ruby in travis and I am. Could you @mahigawas28 provide a little more info maybe a backtrace or an example project so I can debug the issue faster.
from active_mocker.
@zeisler I am getting this error in lenny project of renewfiancial, please find below error log details
AvmDbProperty has the following errors: ActiveMocker.safe_methods is unable to find methods: __missing_class_macros__ error ActiveMocker.safe_methods is unable to find methods: __missing_class_macros__ /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/mock_creator/defined_methods.rb:30:in
create_method'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/mock_creator/defined_methods.rb:20:in block in class_methods' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/mock_creator/defined_methods.rb:20:in
map'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/mock_creator/defined_methods.rb:20:in class_methods' (erb):7:in
block in partials'
/Users/mgavas/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/erb.rb:876:in eval' /Users/mgavas/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/erb.rb:876:in
result'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/mock_creator.rb:121:in block in partials' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/mock_creator.rb:117:in
each'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/mock_creator.rb:117:in each_with_object' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/mock_creator.rb:117:in
partials'
(erb):5:in template_creator_default' /Users/mgavas/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/erb.rb:876:in
eval'
/Users/mgavas/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/erb.rb:876:in result' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/template_creator.rb:15:in
render'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/mock_creator.rb:49:in render' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/mock_creator.rb:44:in
create'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/file_writer.rb:72:in create_mock' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/file_writer.rb:21:in
process!'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/file_writer.rb:15:in block in write!' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/file_writer.rb:33:in
block in safe_write'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/file_writer.rb:31:in open' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/file_writer.rb:31:in
safe_write'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/file_writer.rb:15:in write!' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/generate.rb:58:in
write_file'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/generate.rb:21:in block in call' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/generate.rb:20:in
each'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/generate.rb:20:in call' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/active_mocker-2.6.1.beta2/lib/active_mocker/public_methods.rb:31:in
create_mocks'
/Users/mgavas/projects/lenny/tasks/active_mocker.rake:21:in block (2 levels) in <top (required)>' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/rake-12.0.0/lib/rake/task.rb:250:in
block in execute'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/rake-12.0.0/lib/rake/task.rb:250:in each' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/rake-12.0.0/lib/rake/task.rb:250:in
execute'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/rake-12.0.0/lib/rake/task.rb:194:in block in invoke_with_call_chain' /Users/mgavas/.rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/monitor.rb:226:in
mon_synchronize'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/rake-12.0.0/lib/rake/task.rb:187:in invoke_with_call_chain' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/rake-12.0.0/lib/rake/task.rb:180:in
invoke'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/rake-12.0.0/lib/rake/application.rb:152:in invoke_task' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/rake-12.0.0/lib/rake/application.rb:108:in
block (2 levels) in top_level'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/rake-12.0.0/lib/rake/application.rb:108:in each' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/rake-12.0.0/lib/rake/application.rb:108:in
block in top_level'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/rake-12.0.0/lib/rake/application.rb:117:in run_with_threads' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/rake-12.0.0/lib/rake/application.rb:102:in
top_level'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/rake-12.0.0/lib/rake/application.rb:80:in block in run' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/rake-12.0.0/lib/rake/application.rb:178:in
standard_exception_handling'
/Users/mgavas/.rvm/gems/ruby-2.5.5/gems/rake-12.0.0/lib/rake/application.rb:77:in run' /Users/mgavas/.rvm/gems/ruby-2.5.5/gems/rake-12.0.0/exe/rake:27:in
<top (required)>'
/Users/mgavas/.rvm/gems/ruby-2.5.5/bin/rake:23:in load' /Users/mgavas/.rvm/gems/ruby-2.5.5/bin/rake:23:in
/Users/mgavas/.rvm/gems/ruby-2.5.5/bin/ruby_executable_hooks:24:in
eval' /Users/mgavas/.rvm/gems/ruby-2.5.5/bin/ruby_executable_hooks:24:in
'RuntimeError`
Sample model code
`require_relative "application_record"
module ReportParser
module UnderwritingData
# ActiveMocker.all_methods_safe
class Property < ApplicationRecord
self.table_name = "property"
has_many :property_owners, class_name: "ReportParser::UnderwritingData::PropertyOwner"
module PropertyValueLabels
def property_value_label
"abc"
end
def property_attribute_name
if self.try(:property_state) == "FL"
"xyz"
else
"sample"
end
end
end
include PropertyValueLabels
extend PropertyValueLabels
def property_value
return "property_value"
end
def confidence_score
return 0
end
def valuation_date
return Date.today
end
def table_name
self.class.table_name
end
end
end
end
`
from active_mocker.
Thanks for that extra information. I can try to dig into this sometime this week.
from active_mocker.
@mahigawas28 I have been trying to reproduce this error and have been unable, but I could have a solution although I am unable to test it.
Add the following monkey patch to config/initializers/active_mocker.rb
module ActiveMocker
class MockCreator
module DefinedMethods
def class_methods
class_introspector
.get_class
.methods(false)
.reject {|m| [:__missing_class_macros__].include?(m.to_sym)}
.sort
.map { |m| create_method(m, :method) }
end
end
end
end
If you find that there are more methods like __missing_class_macros__
showing up add it to the array.
I know this is only a hack, but the only way I could possible find a way to fix this is for you to give me a minimal repo that reproduces the error.
from active_mocker.
Related Issues (20)
- Correctly Support many through
- Minitest support? HOT 1
- missing forwardable dependency HOT 2
- Support polymorphic associations HOT 3
- Ignore modules
- Superclass mismatch
- Some mechanism for ignoring DSL code in classes HOT 1
- Be more optimistic with rake dependency (rake 11) HOT 3
- Can't generate mocks for rails Concerns HOT 14
- Error message "To see more/less detail set error_verbosity = 0, 1, 2, 3" very unclear. How do you set error_verbosity with rake? HOT 4
- Database type 'jsonb' is not a registered type. To register use ActiveRecordSchemaScrapper::Attributes.register_type(name: :jsonb, klass: <RubyClass>) HOT 5
- Support first_or_create on collection HOT 1
- undefined method `colorize' for "superclass must be a Class (Module given)":String HOT 5
- Copy across attr_accessors and cattr_accessors HOT 8
- Constant values assigned to non sudo primitives objects
- Missing schema information on a non abstract model does not fail.
- Less warnings when generating for mixed model and non model files. HOT 1
- Using a default value for decimal data types results in a failing mock class generated in 2.2.3 and a mock class syntax error in version 2.0.0 HOT 5
- Calling update on a record should call save as well. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from active_mocker.