gazay / gon

Your Rails variables in your JS
MIT License
3.05k stars 185 forks source link

gon is picking up methods from ApplicationHelper #204

Open justin808 opened 8 years ago

justin808 commented 8 years ago

I'm getting a very strange behavior when running feature spec

I get this error:

      RuntimeError:
        You can't use Gon public methods for storing data
      # /Users/justin/.rvm/gems/ruby-2.2.4@bpos/gems/gon-6.0.1/lib/gon.rb:39:in `method_missing'

I don't get this error when running tests individually.

What's odd is that running the tests in batch is mixing ApplicationHelper into gon, as this debug tracing shows.

Sure, I can rename the method in my ApplicationHelper, but is this expected?

public_methods = [
    [  0]                                                  !()                                                                                        Class (BasicObject)
    [  1]                                                 !=(arg1)                                                                                    Class (BasicObject)
    [  2]                                                 !~(arg1)                                                                                    Class (Kernel)
    [  3]                                                  <(arg1)                                                                                    Class (Module)
    [  4]                                                 <=(arg1)                                                                                    Class (Module)
    [  5]                                                <=>(arg1)                                                                                    Class (Module)
    [  6]                                                 ==(arg1)                                                                                    Class (Module)
    [  7]                                                ===(arg1)                                                                                    Class (Module)
    [  8]                                                 =~(arg1)                                                                                    Class (Kernel)
    [  9]                                                  >(arg1)                                                                                    Class (Module)
    [ 10]                                                 >=(arg1)                                                                                    Class (Module)
    [ 11]                                        __binding__()                                                                                        Class (Object)
    [ 12]                                             __id__()                                                                                        Class (BasicObject)
    [ 13]                                           __send__(*arg1)                                                                                   Class (BasicObject)
    [ 14]                                                  `(command)                                                                                 Class (Object)
    [ 15]                                         acts_like?(duck)                                                                                    Class (Object)
    [ 16]                                  add_method_tracer(method_name, *metric_name_code, *options)                                                Class (NewRelic::Agent::MethodTracer::ClassMethods)
    [ 17]                                        admin_mode?()                                                                                        Class (ApplicationHelper)
    [ 18]                                                 ai(*options)                                                                                Class (Kernel)
    [ 19]                                    alias_attribute(new_name, old_name)                                                                      Class (Module)
    [ 20]                                 alias_method_chain(target, feature)                                                                         Class (Module)
    [ 21]                                      all_variables()                                                                                        Gon
    [ 22]                                           allocate()                                                                                        Class
    [ 23]                                          ancestors()                                                                                        Class (Module)
    [ 24]                                         anonymous?()                                                                                        Class (Module)
    [ 25]                                            as_json(*options)                                                                                Class (Object)
    [ 26]                               assemble_code_header(method_name, metric_name_code, options)                                                  Class (NewRelic::Agent::MethodTracer::ClassMethods::AddMethodTracer)
    [ 27]                                      attr_internal(*attrs)                                                                                  Class (Module)
    [ 28]                             attr_internal_accessor(*attrs)                                                                                  Class (Module)
    [ 29]                               attr_internal_reader(*attrs)                                                                                  Class (Module)
    [ 30]                               attr_internal_writer(*attrs)                                                                                  Class (Module)
    [ 31]                                           autoload(arg1, arg2)                                                                              Class (Module)
    [ 32]                                          autoload?(arg1)                                                                                    Class (Module)
    [ 33]                                    awesome_inspect(*options)                                                                                Class (Kernel)
    [ 34]                                      awesome_print(object, *options)                                                                        Class (Kernel)
    [ 35]                                             blank?()                                                                                        Class (Object)
    [ 36]                                          blink_inc()                                                                                        Class (ApplicationHelper)
    [ 37]                                         bullet_key()                                                                                        Class (Object)
    [ 38]                                             byebug()                                                                                        Class (Kernel)
    [ 39]                                            capture(stream)                                                                                  Class (Kernel)
    [ 40]                                     cattr_accessor(*syms, &blk)                                                                             Class (Module)
    [ 41]                                       cattr_reader(*syms)                                                                                   Class (Module)
    [ 42]                                       cattr_writer(*syms)                                                                                   Class (Module)
    [ 43]                            check_for_illegal_keys!(method_name, options)                                                                    Class (NewRelic::Agent::MethodTracer::ClassMethods::AddMethodTracer)
    [ 44]                    check_for_push_scope_and_metric(options)                                                                                 Class (NewRelic::Agent::MethodTracer::ClassMethods::AddMethodTracer)
    [ 45]                                              class()                                                                                        Class (Kernel)
    [ 46]                                    class_attribute(*attrs)                                                                                  Class
    [ 47]                                         class_eval(*arg1)                                                                                   Class (Module)
    [ 48]                                         class_exec(*arg1)                                                                                   Class (Module)
    [ 49]                            class_variable_defined?(arg1)                                                                                    Class (Module)
    [ 50]                                 class_variable_get(arg1)                                                                                    Class (Module)
    [ 51]                                 class_variable_set(arg1, arg2)                                                                              Class (Module)
    [ 52]                                    class_variables(*arg1)                                                                                   Class (Module)
    [ 53]                                              clear()                                                                                        Gon
    [ 54]                                              clone()                                                                                        Class (Kernel)
    [ 55]                                       code_to_eval(method_name, metric_name_code, options)                                                  Class (NewRelic::Agent::MethodTracer::ClassMethods::AddMethodTracer)
    [ 56]                                            concern(topic, &module_definition)                                                               Class (Module::Concerning)
    [ 57]                                         concerning(topic, &block)                                                                           Class (Module::Concerning)
    [ 58]                                     const_defined?(*arg1)                                                                                   Class (Module)
    [ 59]                                          const_get(*arg1)                                                                                   Class (Module)
    [ 60]                                      const_missing(const_name)                                                                              Class (ActiveSupport::Dependencies::ModuleConstMissing)
    [ 61]                                          const_set(arg1, arg2)                                                                              Class (Module)
    [ 62]                                          constants(*arg1)                                                                                   Class (Module)
    [ 63]                                            context(*a, &b)                                                                                  Class (Module)
    [ 64]                                   current_location()                                                                                        Class (ApplicationHelper)
    [ 65]                                current_location_id()                                                                                        Class (ApplicationHelper)
    [ 66]                                        dart_inline(text)                                                                                    Class (ApplicationHelper)
    [ 67]                                             dclone()                                                                                        Class (Object)
    [ 68]                                           debugger()                                                                                        Class (Kernel)
    [ 69]                                           deep_dup()                                                                                        Class (Object)
    [ 70]                           default_metric_name_code(method_name)                                                                             Class (NewRelic::Agent::MethodTracer::ClassMethods::AddMethodTracer)
    [ 71]                            define_singleton_method(*arg1)                                                                                   Class (Kernel)
    [ 72]                                              delay(*options)                                                                                Class (Sidekiq::Extensions::Klass)
    [ 73]                                          delay_for(interval, *options)                                                                      Class (Sidekiq::Extensions::Klass)
    [ 74]                                        delay_until(timestamp, *options)                                                                     Class (Sidekiq::Extensions::Klass)
    [ 75]                                           delegate(*methods)                                                                                Class (Module)
    [ 76]                                          deprecate(*method_names)                                                                           Class (Module)
    [ 77]                                        descendants()                                                                                        Class
    [ 78]                                           describe(*a, &b)                                                                                  Class (Module)
    [ 79]                                            display(*arg1)                                                                                   Class (Kernel)
    [ 80]                             display_error_messages(errors, resource_name)                                                                   Class (ApplicationHelper)
    [ 81]                                 display_errors_for(active_record)                                                                           Class (ApplicationHelper)
    [ 82]                                                dup()                                                                                        Class (Kernel)
    [ 83]                                        duplicable?()                                                                                        Class (Object)
    [ 84]                                           ec_mode?()                                                                                        Class (ApplicationHelper)
    [ 85]                                    enable_warnings()                                                                                        Class (Kernel)
    [ 86]                                           enum_for(*arg1)                                                                                   Class (Kernel)
    [ 87]                                               eql?(arg1)                                                                                    Class (Kernel)
    [ 88]                                             equal?(arg1)                                                                                    Class (BasicObject)
    [ 89]                                      example_group(*a, &b)                                                                                  Class (Module)
    [ 90]                                             extend(*arg1)                                                                                   Class (Kernel)
    [ 91]                                           fcontext(*a, &b)                                                                                  Class (Module)
    [ 92]                                          fdescribe(*a, &b)                                                                                  Class (Module)
    [ 93]                                            feature(*a, &b)                                                                                  Class (Module)
    [ 94]                                           ffeature(*a, &b)                                                                                  Class (Module)
    [ 95]                                      format_errors(errors, resource_name, sentence)                                                         Class (ApplicationHelper)
    [ 96]                                             freeze()                                                                                        Class (Module)
    [ 97]                                            frozen?()                                                                                        Class (Kernel)
    [ 98]                                                gem(dep, *reqs)                                                                              Class (Kernel)
    [ 99]                                      get_image_url(image_or_order_item, *no_watermark)                                                      Class (ApplicationHelper)
    [100]                                   get_stats_scoped(first_name, scoped_metric_only)                                                          Class (NewRelic::Agent::MethodTracer)
    [101]                                 get_stats_unscoped(name)                                                                                    Class (NewRelic::Agent::MethodTracer)
    [102]                                       get_variable(name)                                                                                    Gon
    [103]                                             global()                                                                                        Gon
    [104]                                guess_for_anonymous(const_name)                                                                              Class (ActiveSupport::Dependencies::ModuleConstMissing)
    [105]                                               hash()                                                                                        Class (Kernel)
    [106]                                    hosted_file_url(file_name)                                                                               Class (ApplicationHelper)
    [107]                                         html_safe?()                                                                                        Class (Object)
    [108]                                                in?(another_object)                                                                          Class (Object)
    [109]                                         in_dollars(amount)                                                                                  Class (ApplicationHelper)
    [110]                                            include(*arg1)                                                                                   Class (Module)
    [111]                                           include?(arg1)                                                                                    Class (Module)
    [112]                                   included_modules()                                                                                        Class (Module)
    [113]                                            inspect()                                                                                        Gon
    [114]                                      instance_eval(*arg1)                                                                                   Class (BasicObject)
    [115]                                      instance_exec(*arg1)                                                                                   Class (BasicObject)
    [116]                                    instance_method(arg1)                                                                                    Class (Module)
    [117]                                   instance_methods(*args)                                                                                   Class
    [118]                                       instance_of?(arg1)                                                                                    Class (Kernel)
    [119]                                    instance_values()                                                                                        Class (Object)
    [120]                         instance_variable_defined?(arg1)                                                                                    Class (Kernel)
    [121]                              instance_variable_get(arg1)                                                                                    Class (Kernel)
    [122]                            instance_variable_names()                                                                                        Class (Object)
    [123]                              instance_variable_set(arg1, arg2)                                                                              Class (Kernel)
    [124]                                 instance_variables()                                                                                        Class (Kernel)
    [125]                                              is_a?(arg1)                                                                                    Class (Kernel)
    [126]                                           is_haml?()                                                                                        Class (Object)
    [127]                                             itself()                                                                                        Class (Kernel)
    [128]                                           jbuilder(*args)                                                                                   Gon
    [129]                                    json_creatable?()                                                                                        Class
    [130]                                           kind_of?(arg1)                                                                                    Class (Kernel)
    [131]                                    load_dependency(file)                                                                                    Class (ActiveSupport::Dependencies::Loadable)
    [132]                                    local_constants()                                                                                        Class (Module)
    [133]                                           login_as(user, *opts)                                                                             Class (Warden::Test::Helpers)
    [134]                                             logout(*scopes)                                                                                 Class (Warden::Test::Helpers)
    [135]                                     mattr_accessor(*syms, &blk)                                                                             Class (Module)
    [136]                                       mattr_reader(*syms)                                                                                   Class (Module)
    [137]                                       mattr_writer(*syms)                                                                                   Class (Module)
    [138]                                     merge_variable(name, value)                                                                             Gon
    [139]                                   meta_description(meta_desc)                                                                               Class (ApplicationHelper)
    [140]                                      meta_keywords(meta_keys)                                                                               Class (ApplicationHelper)
    [141]                                         meta_title(*page_title)                                                                             Class (ApplicationHelper)
    [142]                                             method(arg1)                                                                                    Class (Kernel)
    [143]                                    method_defined?(arg1)                                                                                    Class (Module)
    [144]                                     method_missing(method, *args, &block)                                                                   Gon
    [145]                             method_with_push_scope(method_name, metric_name_code, options)                                                  Class (NewRelic::Agent::MethodTracer::ClassMethods::AddMethodTracer)
    [146]                          method_without_push_scope(method_name, metric_name_code, options)                                                  Class (NewRelic::Agent::MethodTracer::ClassMethods::AddMethodTracer)
    [147]                                            methods(*args)                                                                                   Class (Object)
    [148]                            methods_transplantable?()                                                                                        Class (Module)
    [149]                                   mode_for_request()                                                                                        Class (ApplicationHelper)
    [150]                                        module_eval(*arg1)                                                                                   Class (Module)
    [151]                                        module_exec(*arg1)                                                                                   Class (Module)
    [152]                          my_devise_error_messages!()                                                                                        Class (ApplicationHelper)
    [153]                                               name()                                                                                        Class (Module)
    [154]                                                new(*arg1)                                                                                   Class
    [155]                            newrelic_method_exists?(method_name)                                                                             Class (NewRelic::Agent::MethodTracer::ClassMethods::AddMethodTracer)
    [156]                                           next_url()                                                                                        Class (ApplicationHelper)
    [157]                                               nil?()                                                                                        Class (Kernel)
    [158]                                          object_id()                                                                                        Class (Kernel)
    [159]                                             parent()                                                                                        Class (Module)
    [160]                                        parent_name()                                                                                        Class (Module)
    [161]                                            parents()                                                                                        Class (Module)
    [162]                                     pluralize_only(count, singular, *plural)                                                                Class (ApplicationHelper)
    [163]                                            prepend(*arg1)                                                                                   Class (Module)
    [164]                                           presence()                                                                                        Class (Object)
    [165]                                        presence_in(another_object)                                                                          Class (Object)
    [166]                                           present?()                                                                                        Class (Object)
    [167]                                     pretty_inspect()                                                                                        Class (Kernel)
    [168]                                       pretty_print(q)                                                                                       Class (Module)
    [169]                                 pretty_print_cycle(q)                                                                                       Class (Module)
    [170]                               pretty_print_inspect()                                                                                        Class (PP::ObjectMixin)
    [171]                    pretty_print_instance_variables()                                                                                        Class (PP::ObjectMixin)
    [172]                                  primary_key_value()                                                                                        Class (Object)
    [173]                               private_class_method(*arg1)                                                                                   Class (Module)
    [174]                                   private_constant(*arg1)                                                                                   Class (Module)
    [175]                           private_instance_methods(*args)                                                                                   Class
    [176]                            private_method_defined?(arg1)                                                                                    Class (Module)
    [177]                                    private_methods(*args)                                                                                   Class (Object)
    [178]                                            process(*arg1)                                                                                   Class (Devise::TestHelpers)
    [179]                                     producer_mode?()                                                                                        Class (ApplicationHelper)
    [180]                         protected_instance_methods(*args)                                                                                   Class
    [181]                          protected_method_defined?(arg1)                                                                                    Class (Module)
    [182]                                  protected_methods(*args)                                                                                   Class (Object)
    [183]                                                pry(*object, *hash)                                                                          Class (Object)
    [184]                                      psych_to_yaml(*options)                                                                                Class (Object)
    [185]                                      psych_yaml_as(url)                                                                                     Class (Module)
    [186]                                public_class_method(*arg1)                                                                                   Class (Module)
    [187]                                    public_constant(*arg1)                                                                                   Class (Module)
    [188]                             public_instance_method(arg1)                                                                                    Class (Module)
    [189]                            public_instance_methods(*args)                                                                                   Class
    [190]                                      public_method(arg1)                                                                                    Class (Kernel)
    [191]                             public_method_defined?(arg1)                                                                                    Class (Module)
    [192]                                     public_methods(*args)                                                                                   Class (Object)
    [193]                                        public_send(*arg1)                                                                                   Class (Kernel)
    [194]                                               push(*data, *merge)                                                                           Gon
    [195]                           qualified_const_defined?(path, *search_parents)                                                                   Class (Module)
    [196]                                qualified_const_get(path)                                                                                    Class (Module)
    [197]                                qualified_const_set(path, value)                                                                             Class (Module)
    [198]                                            quietly()                                                                                        Class (Kernel)
    [199]                                               rabl(*args)                                                                                   Gon
    [200]                                     rake_extension(method)                                                                                  Class (Module)
    [201]                                         reachable?()                                                                                        Class (Module)
    [202]                                    redefine_method(method, &block)                                                                          Class (Module)
    [203]                              remove_class_variable(arg1)                                                                                    Class (Module)
    [204]                           remove_instance_variable(arg1)                                                                                    Class (Kernel)
    [205]                               remove_method_tracer(method_name, metric_name_code)                                                           Class (NewRelic::Agent::MethodTracer::ClassMethods)
    [206]                             remove_possible_method(method)                                                                                  Class (Module)
    [207]                                 require_dependency(file_name, *message)                                                                     Class (ActiveSupport::Dependencies::Loadable)
    [208]                                    require_or_load(file_name)                                                                               Class (ActiveSupport::Dependencies::Loadable)
    [209]                                        respond_to?(*arg1)                                                                                   Class (Kernel)
    [210]                                               send(*arg1)                                                                                   Class (Kernel)
    [211]                                       set_variable(name, value)                                                                             Gon
    [212]                        setup_controller_for_warden()                                                                                        Class (Devise::TestHelpers)
    [213]                                     shared_context(name, *args, &block)                                                                     Class (Module)
    [214]                                    shared_examples(name, *args, &block)                                                                     Class (Module)
    [215]                                shared_examples_for(name, *args, &block)                                                                     Class (Module)
    [216]                                         short_date(*args, &block)                                                                           Class (ApplicationHelper)
    [217]                                       shorter_date(*args, &block)                                                                           Class (ApplicationHelper)
    [218]                                   shorter_datetime(*args, &block)                                                                           Class (ApplicationHelper)
    [219]                                      shortest_date(*args, &block)                                                                           Class (ApplicationHelper)
    [220]                                      sidekiq_delay(*options)                                                                                Class (Sidekiq::Extensions::Klass)
    [221]                                  sidekiq_delay_for(interval, *options)                                                                      Class (Sidekiq::Extensions::Klass)
    [222]                                sidekiq_delay_until(timestamp, *options)                                                                     Class (Sidekiq::Extensions::Klass)
    [223]                                            sign_in(resource_or_scope, *resource)                                                            Class (Devise::TestHelpers)
    [224]                                           sign_out(resource_or_scope)                                                                       Class (Devise::TestHelpers)
    [225]                                            silence(stream)                                                                                  Class (Kernel)
    [226]                                     silence_stderr()                                                                                        Class (Kernel)
    [227]                                     silence_stream(stream)                                                                                  Class (Kernel)
    [228]                                   silence_warnings()                                                                                        Class (Kernel)
    [229]                             simple_formatted_error(msg)                                                                                     Class (ApplicationHelper)
    [230]                                    singleton_class()                                                                                        Class (Kernel)
    [231]                                   singleton_class?()                                                                                        Class (Module)
    [232]                                   singleton_method(arg1)                                                                                    Class (Kernel)
    [233]                                  singleton_methods(*args)                                                                                   Class (Object)
    [234]                                        store_mode?()                                                                                        Class (ApplicationHelper)
    [235]                                         subclasses()                                                                                        Class
    [236]                                         superclass()                                                                                        Class
    [237]                     superclass_delegating_accessor(*args, &block)                                                                           Class
    [238]    superclass_delegating_accessor_with_deprecation(*args, &block)                                                                           Class
    [239] superclass_delegating_accessor_without_deprecation(name, *options)                                                                          Class
    [240]                                           suppress(*exception_classes)                                                                      Class (Kernel)
    [241]                                  suppress_warnings()                                                                                        Class (Kernel)
    [242]                                              taint()                                                                                        Class (Kernel)
    [243]                                           tainted?()                                                                                        Class (Kernel)
    [244]                                                tap()                                                                                        Class (Kernel)
    [245]                                          test_env?()                                                                                        Class (ApplicationHelper)
    [246]                                            to_enum(*arg1)                                                                                   Class (Kernel)
    [247]                                            to_json(*options)                                                                                Class (Object)
    [248]                to_json_with_active_support_encoder(*options)                                                                                Class (Object)
    [249]             to_json_without_active_support_encoder(*arg1)                                                                                   Class (BasicObject)
    [250]                                           to_param()                                                                                        Class (Object)
    [251]                                           to_query(key)                                                                                     Class (Object)
    [252]                                               to_s()                                                                                        Class (Module)
    [253]                                            to_yaml(*options)                                                                                Class (Object)
    [254]                                 to_yaml_properties()                                                                                        Class (Object)
    [255]                             trace_execution_scoped(metric_names, *options)                                                                  Class (NewRelic::Agent::MethodTracer)
    [256]                           trace_execution_unscoped(metric_names, *options)                                                                  Class (NewRelic::Agent::MethodTracer)
    [257]                             trace_method_execution(metric_names, push_scope, produce_metric, deduct_call_time_from_parent, &block)          Class (NewRelic::Agent::MethodTracer)
    [258]                    trace_method_execution_no_scope(metric_names, *options)                                                                  Class (NewRelic::Agent::MethodTracer)
    [259]                  trace_method_execution_with_scope(metric_names, produce_metric, deduct_call_time_from_parent, *scoped_metric_only, &block) Class (NewRelic::Agent::MethodTracer)
    [260]                              traced_method_exists?(method_name, metric_name_code)                                                           Class (NewRelic::Agent::MethodTracer::ClassMethods::AddMethodTracer)
    [261]                                              trust()                                                                                        Class (Kernel)
    [262]                                                try(*a, &b)                                                                                  Class (Object)
    [263]                                               try!(*a, &b)                                                                                  Class (Object)
    [264]                                   twitterized_type(type)                                                                                    Class (ApplicationHelper)
    [265]                                   ui_error_display(msg)                                                                                     Class (ApplicationHelper)
    [266]                                         unloadable(*const_desc)                                                                             Class (ActiveSupport::Dependencies::ModuleConstMissing)
    [267]                                            untaint()                                                                                        Class (Kernel)
    [268]                                            untrust()                                                                                        Class (Kernel)
    [269]                                         untrusted?()                                                                                        Class (Kernel)
    [270]                                   validate_options(method_name, options)                                                                    Class (NewRelic::Agent::MethodTracer::ClassMethods::AddMethodTracer)
    [271]                                             warden()                                                                                        Class (Devise::TestHelpers)
    [272]                                              watch()                                                                                        Gon
    [273]                                       with_options(options, &block)                                                                         Class (Object)
    [274]                                      with_warnings(flag)                                                                                    Class (Kernel)
    [275]                                           xcontext(*a, &b)                                                                                  Class (Module)
    [276]                                          xdescribe(*a, &b)                                                                                  Class (Module)
    [277]                                           xfeature(*a, &b)                                                                                  Class (Module)
    [278]                                            yaml_as(url)                                                                                     Class (Module)
    [279]                                           yaml_tag(url)                                                                                     Gon (Object)
]
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ