> , Author at Vinova - Page 452

Ruby underscore and classify methods

These are two Rails helpers that could be very useful when injecting new instance methods in a class. underscore Converts from a class name to a underscore attribute. ‘MyClassName’.underscore => my_class_name classify Inverse method from underscore. >> “cool_articles”.classify => “CoolArticles” >> “comment”.classify => “Comment” Both, combined with singularize and pluralize, allows us to handle parent/child methods in a very handy way. For example: elements_in_ = self.send(parent).send(self.class.to_s.pluralize.underscore) or things like Kernel.const_get(table_model.to_s.classify).find(:all) #Kernel.const_get gets an string and retrieves the class. source:...

Link Building for SEO

Most people know that incoming links are an important part of improving your websites ranking, but should you focus your link building SEO efforts on obtaining a large quantity of easily obtainable links from wherever you can get them, or focus on obtaining high quality links that are typically harder to get? Most link building experts would agree that both quantity and quality are important, and in most cases (although there are exceptions), any link to your website helps. However, because of the way Google and other search engines value links, focusing your link building SEO efforts on quality is more often than not the better choice. So what makes a link a “quality link” and why is quality more important than quantity? To best understand why quality is more important than quantity we need to see link building SEO from the perspective of Google. Google places a value on every website and every webpage that it indexes. The most famous measure of a website and webpage’s value is Google’s PageRank. Google assigns each webpage a ranking from 0 to 10 as a measure of its authority. Webpages with a ranking of zero are typically very new and insignificant. Webpages with a ranking of ten carry an unprecedented amount of authority. An example of a webpage or website with a rank or zero might be a new blog or a new small website for a pet store. An example of a PageRank of ten would be the Google.com or USA.gov. Google considers links that come from websites with a higher PageRank to be more important than links that come...

Testing for javascript alerts with Cucumber & Capybara

Using Cumcumber + Capybara to run automated testing is a TRENDY now. But you might have trouble finding a way to assert a javascript alert, for e.g. a link created by the link_to … :confirm => “Are you sure?” and similar. Don’t worry, here is a work around to confirm Javascript alert and dialog in your Capybara tests, simply override alert and confirm methods: Given /^I will confirm on next step$/ do begin evaluate_script(“window.alert = function(msg) { return true; }”) evaluate_script(“window.confirm = function(msg) { return true; }”) rescue Capybara::NotSupportedByDriverError end end Rescue here is added in case, you run want to run your tests without javascript (e.g. default capybara driver). If you run feature without javascript simply nothing will happen. Moreover, using this technique you can simulate moving mouse over some elements. It is useful, when you have links that appears when certain div is under the mouse cursor. Then /^I move mouse over “([^”]*)”$/ do |label| begin Capybara.current_session.driver.browser.execute_script(“$(‘#{label}’).mouseover();”) rescue Capybara::NotSupportedByDriverError end end That’s it. Happy testing...
Malcare WordPress Security

mobile apps singapore,website developer singapore,ios developer singapore,singapore mobile app developer,mobile apps development singapore,web designer singapore,app developer singapore,developer in singapore,web design services singapore,graphic designer in singapore,website development singapore,mobile application developer singapore,web design company singapore,singapore mobile application developer,design agency singapore,web application singapore,web development singapore,app development singapore,android developer singapore,ruby on rails developer singapore,mobile app development singapore,mobile app developer singapore,mobile developer singapore,ios app development singapore,singapore web design,mobile application development singapore,singapore app developer,website design singapore,website designer singapore,singapore web development,mobile game developer singapore,design firms in singapore,developers in singapore,web design singapore,singapore website design,singapore web design services,web development company singapore