# visit page.driver.last_request.env['HTTP_REFERER'] # old visit page.driver.request.env['HTTP_REFERER'] # new # or for javascript tests: page.execute_script('window.history.back()') end undefined method locate for #Capybara::Session (NoMethodError) Use page.find instead of...
...now wrapped by a html document skeleton. Use page.text instead. (e.g. when you are testing correct JSON which is in fact not wrapped by a html sceleton) An element can...
email: migration_user.email, phone: migration_user.phone ) end end end Now the best idea is to test this in the rails sandbox (so your development data stay untouched): rails console --sandbox...
...MySQL console and execute SHOW TABLE STATUS FROM database; mysql> SHOW TABLE STATUS FROM test; +-------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-----------------+----------+----------------+---------+ | Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index...
...free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment | +-------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-----------------+----------+----------------+---------+ | test1 | MyISAM | 10 | Dynamic...
Most of these will not work in newer projects because these use the Capybara/Rack::Test combo in lieu of Webrat. Find input fields Then /^there should be a "([^"]+)" field$/ do...
Running Cucumber tests while your cucumber.yml is 100% valid may still produce the following error. cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on...
...While the FULLTEXT approach was many times faster than the LIKE approach in my tests, both approaches seem to scale linearly with the number of records. For a typical web...
We used zeroclipboard.js in some of our projects but now we switched to clipboard.js because it does not rely on...
the output is optional of course but might be helpful when you first test the migration and rollback
...a button on a Selenium-controlled browser, the call will return control to your test before the next page is loaded. This can lead to concurrency issues when a Cucumber...
...will be missing. Use this instead: rake gems:unpack GEM=cucumber_factory RAILS_ENV=test
...a production console. You often won't notice this because for the development and test environments auto_flushing is set to write after each line. On production environments the Rails...
...What Consul does internally is fetch all the IDs of the power.posts scope and test if the given record's ID is among them. This list of IDs is cached...
If you need to test some HTML, e.g. an embed code, you can use RubyMine's "scratch files": File > New Scratch File (or Ctrl + Shift + Alt + Ins) Select "HTML" as...
Note that you need to write all selectors in lowercase letters in your tests. Capybara talks HTML, after all, and in HTML tags and attributes are case-insensitive (as...
...If you haven't installed Firefox 24 yet, the next time you run tests with Geordi, it will tell you how to install it. On a Rails 2 project:
-> Remove cucumber_spinner from Gemfile. We're not using it in parallel_tests anyway...
Some helpers for poking around at your Capybara driven browser's cookies in integration tests. Supports Capybara's bundled drivers (rack-test, Selenium Webdriver), and adapters for other drivers may...
...for Ruby. It could be run periodically from a scheduler and check if application tests are broken. In case of failed tests Cerberus sends notification to developers...
It turned out that the test subject didn't know that longdesc even existed before the tester told him about it. Can you blame him...
Rake tasks to run specs and tests in parallel, to use multiple CPUs and speedup test runtime...
Mockito is a mocking framework that tastes really good. It lets you write beautiful tests with clean & simple API. Mockito doesn't give you hangover because the tests are very...
RESTClient is a Java application to test RESTful webservices. It can be used to test variety of HTTP communications...
Test spies are a form of test double that preserves the normal four-phase unit
...account, users will get a BCrypt::Errors::InvalidHash when trying to sign in. Your tests will not notice this, since they create new users for each scenario.
...Here is how to circumvent that. What's going on? You are making ActionController::TestRequests in your specs, and their #initialize method does this: self.session = TestSession.new This means that each...
...behavior by stubbing the controller's session and querying that stub: persisted_session = ActionController::TestSession.new controller.stub :session => persisted_session # do things persisted_session[:something].should ... Apply this workaround only when...