This is content converted from Markdown!
Here's a JSON sample:
{
"foo": "bar"
}
<html> | |
<head> | |
<style> | |
h1 { | |
font-family: Calibri; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Hello World!</h1> |
Test Dropzone.js File Uploads With Capybara | |
Dec 29, 2014 | |
Integration tests involving complex JS interactions are a pain, especially with something like drag and drop file uploads (you can’t exactly drag something into a headless browser). My recent use case was an AngularJS application using Dropzone.js with Ruby on Rails on the backend, so I needed a way to make Dropzone play nicely with Capybara Webkit. Here is the spec helper I ended up with: | |
def drop_in_dropzone(file_path) | |
# Generate a fake input selector | |
page.execute_script <<-JS | |
fakeFileInput = window.$('<input/>').attr( | |
{id: 'fakeFileInput', type:'file'} |
Test Dropzone.js File Uploads With Capybara | |
Dec 29, 2014 | |
Integration tests involving complex JS interactions are a pain, especially with something like drag and drop file uploads (you can’t exactly drag something into a headless browser). My recent use case was an AngularJS application using Dropzone.js with Ruby on Rails on the backend, so I needed a way to make Dropzone play nicely with Capybara Webkit. Here is the spec helper I ended up with: | |
def drop_in_dropzone(file_path) | |
# Generate a fake input selector | |
page.execute_script <<-JS | |
fakeFileInput = window.$('<input/>').attr( | |
{id: 'fakeFileInput', type:'file'} |
Debugging Capybara | |
"save_and_open_page" |
Rails.application.routes.recognize_path(request.referrer) #=> {:controller => "posts", :action => "show"} | |
prev[:action] #=> "show" | |
prev = Rails.application.routes.recognize_path(request.referrer) | |
prev[:controller] #=> "posts" |
To only run the next two migrations: | |
rake db:migrate STEP=2 | |
To revert the previous two migrations: | |
rake db:rollback STEP=2 | |
To revert the last two migrations and then migrate to the most current version: | |
rake db:migrate:redo STEP=2 | |
To migrate to a given migration number, regardless of whether that means migrating up or down: |