testPaymentTypes_exception_in_getting_payment_types(PaymentServiceTests)
|  groovy.lang.MissingMethodException: No signature of method: com.originfunds.service.PaymentService.extractExceptionMessage() is applicable for argument types: (java.lang.Exception) values: [java.lang.Exception: exception]Wednesday, 28 November 2012
Grails: Use of @Mixins in Controller/Services and unit testing methods that uses the mixin methods
So I spent an hour today trying to see why my tests are failing. I have a @Mixin in my service class and I was writing a unit test for a method that calls the mixin method. However, it was giving errors like these:
Saturday, 24 November 2012
Caution: extending Knockout's default bindings
So I'm working on a feature that requires that every input be sent to the server after a user types in the data. What a better way than to decorate the default "value" binding. 
My initial binding looks like this: 
                     ko.bindingHandlers.trackedInput = {  
                          init : function(element, valueAccessor, allBindingsAccessor) {  
                               ko.bindingHandlers.value.init(element, valueAccessor, allBindingsAccessor);  
                          },  
                          update : function(element, valueAccessor) {  
                               track($(element));  
                               ko.bindingHandlers.value.update(element, valueAccessor);  
                          }  
                     }  
Uncaught TypeError: undefined is not a function ko.bindingHandlers.trackedInput = {  
                          init : function(element, valueAccessor, allBindingsAccessor) {  
                               ko.bindingHandlers.value.init(element, valueAccessor, allBindingsAccessor);  
                          },  
                          update : function(element, valueAccessor) {  
                               track($(element));  
                               ko.bindingHandlers.value.update(element, valueAccessor);  
                          }  
                     }  
                     vm = {choice : ko.observable()};  
                     ko.applyBindings(vm);  
                });  
Tuesday, 20 November 2012
Grails unit test: | java.lang.NullPointerException: Cannot get property 'principal' on null object
So I have a controller that uses a command object as the param and the controller also uses the springSecurityService and am writing a test to cover the flow. 
For the life of me, if I don't call .validate() on the mocked command object, I get an error stating that the injected springSecurityService is null:
|  java.lang.NullPointerException: Cannot get property 'principal' on null object
Friday, 16 November 2012
Knockout.js - Calling default foreach in a custom binding
So I created a binding that handles loading images asychroniously and I wanted to have a spinner to load while it's waiting. Initially I came up with something like this:
 ko.bindingHandlers.asyncImgs = {
  init: function (element, valueAccessor) {
   $(element).spin();
  },
  update: function (element, valueAccessor) {
      var value = ko.utils.unwrapObservable(valueAccessor());
      if (value) {
          $(element).spin(false);
                ko.bindingHandlers.foreach.update(element.firstElementChild, valueAccessor);           
         }
  }
 }
      <div class="gifts" style="height: 220px; border: 1px solid" data-bind="asyncImgs: offer_${standardProduct.productIdIndirect}_gifts" data-for="${standardProduct.productIdIndirect}">  
           <div class="gift" data-bind="foreach: $data">  
                <img data-bind="attr: {src: image}"/>  
                <span data-bind="text: description"/>  
           </div>  
      </div>  
 ko.bindingHandlers.asyncImgs = {
  init: function (element, valueAccessor) {
   $(element).spin();
  },
  update: function (element, valueAccessor, allBindings, viewModel, context) {
      var value = ko.utils.unwrapObservable(valueAccessor());
      if (value) {
          $(element).spin(false);
                ko.bindingHandlers.foreach.update(element.firstElementChild, valueAccessor, allBindings, viewModel, context);           
         }
  }
 };
Problem installing ruby on Ubuntu server: "It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby."
I'm getting this issue when I'm trying to install ruby:
It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby.
rvm uninstall all
sudo apt-get gcc install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
rvm install 1.9.3
Friday, 2 November 2012
Ruby/Watir/Cucumber: Taking a screenshot error: No connection could be made because the target machine actively refused it. - connect(2)
I was tasked with investigating a framework that lets QAs and Devs work together so we can get a functional test suite up. One of the tasks is to ensure we can capture screenshots on error so we can troubleshoot it. Here's my original code:
 After do |scenario|  
  if scenario.failed?  
   Dir::mkdir('screenshots') if not File.directory?('screenshots')  
   screenshot = "./screenshots/FAILED_#{scenario.name.gsub(' ','_').gsub(/[^0-9A-Za-z_]/, '')}.png"  
   @browser.driver.save_screenshot(screenshot)  
   embed screenshot, 'image/png'  
  end  
  @browser.close  
 end  
Subscribe to:
Comments (Atom)
