25 April 2014

The Ruby Reflector

Topic

Capybara

  Source Favicon
Email

…meaning Capybara can't automatically detect when the AJAX completes. If Capybara can't see it, neither can our users. Depending on your application, this might be OK.

One solution might be to have an AJAX spinner in a standard location that gets shown when AJAX requests start and hidden when AJAX requests complete. To do this globally in jQuery: jQuery.ajaxSetup({ beforeSend: function(xhr) { $('#spinner').show(); }, // runs after AJAX requests complete, …

robots.thoughtbot.com Read
  Source Favicon
By sarah of the evolving ultrasaurus 3 months ago.
Email

…for Ruby Acceptance Testing, which instigated the rodent naming theme) Capybara is wonderful with its support for many "drivers" which allow for a consistent API across different solutions that offer different levels of browser support, with different performance characteristics.

Capybara:: Webkit

Thoughtbot kindly created the capybara-webkit gem a few years ago, which I've found to be more reliable and performant than Selenium, and is my favorite choice …

ultrasaurus.com Read
  Source Favicon
Email

…feature specs are slow to run. Instead of testing every possible path through your application with Capybara, leave testing edge cases up to your model, view, and controller specs.

I tend to get questions about distinguishing between RSpec and Capybara methods. Capybara methods are the ones that are actually interacting with the page, i.e. clicks, form interaction, or finding elements on the page. Check out the docs for more info on Capybara's finders , matchers , …

robots.thoughtbot.com Read
  Source Favicon
Email

…It's also difficult to test anything in isolation. That's why Cucumber, Capybara, Selenium are so popular, as they help you in writing integrated tests.

Integrated tests have their place, but it's impossible to test everything through all the layers. This results in slow builds - a typical syndrome in Rails projects.

The Rails way makes sense for smaller projects. What I'm disagreeing with is using "The Rails way" in bigger, serious projects.

The …

andrzejonsoftware.blogspot.com Read
  Source Favicon
By Girish Sonawane of RubyLearning Blog 7 months ago.
Email

…specs. Line 8, tells capybara it's a Sinatra app. Line 11, makes capybara DSL available to our specs.

Line 15, 16, 17, adds three pending specs.

If we execute our spec now with rspec spec/acceptance_spec.rb , it says: 1 *** 2 3 Pending: 4 currency converter loads currency converter form 5 # Not yet implemented 6 # ./spec/acceptance_spec.rb:15 7 currency converter converts currencies 8 # Not yet implemented 9 # ./spec/acceptance_spec.rb:16 10 currency …

rubylearning.com Read
  Source Favicon
By livelessons of Videos related to 'Ruby on Rails demo' 9 months ago.
Email

Sprockets & Sass; behavior-driven development ( BDD) with Capybara & Rspec; better automated testing with Guard & Spork; roll your own authentication with has_secure_password; and an introduction to Gherkin & Cucumber. These focused video lessons help you learn crucial new skills fast— and put them to work immediately! Watch top Rails developer Michael Hartl guide you through building a complete application using today's best practices for MVC and REST

youtube.com Read
  Source Favicon
By Matt of Tea-Driven Development 11 months ago.
Email

How Capybara can save you

Many people using Capybara for web automation don't realise how sophisticated it is for solving this problem.

For example, if you ask Capybara to find an element, it will automatically poll the page if it can't find the element right away:

find('.results') # will poll for 5 seconds until this element appears

After five seconds, if the element hasn't appeared, Capybara will raise an error. So your tests won't get stuck forever. …

blog.mattwynne.net Read
  Source Favicon
By Mike Ackerman of Viget.com Blogs 11 months ago.
Email

…some effective asynchronous helper methods: wait_for_ajax , wait_for_dom , and the recently removed Capybara method wait_until . I ended up using a slightly modified version of wait_until that allows me to pass in a block that must return true:

def wait_until require "timeout" Timeout . timeout ( Capybara . default_wait_time ) do sleep ( 0 . 1 ) until yield == true end end wait_until { dom_element [ 'class' ]. include? "is-active" }

While these asynchronous …

viget.com Read
  Source Favicon
By Mike Gunderloy of A Fresh Cup 1 year ago.
Email

pestilence - Some nasty JavaScript tricks.

splinter - Additional syntactic sugar for Capybara and RSpec.

Jeff's Guide to Installing Ruby on Rails - Starting point for beginners. SignedForm - Attach digital signatures to forms in Rails to synchronize permitted fields with your application with no further code.

afreshcup.com Read
  Source Favicon
Email

…example, needed to work around changes in Capybara, is to pull the XPath and Capybara libraries directly from the latest master branches on GitHub, which introduces a significant risk of instability. And there are surely other examples ready to surprise the unwary.

Once the situation has stabilized a bit, I plan to make a short supplementary screencast highlighting the relevant changes and showing how the sample app works with Rails 4. When that happens, I will make sales of the Rails…

railstutorial.org Read