Create a file defining the following variables, with the name .env-for-dump
, for example.
export MYSQL_CONTAINER=
export MYSQL_ORIGIN_PASSWORD=
export MYSQL_ORIGIN_USERNAME=
You are writing a spec with type: :request
, i.e. an integration spec instead
of a controller spec. Integration specs are wrappers around Rails'
ActionDispatch::IntegrationTest
class. I usually write controller tests using
this instead of type: :controller
, mainly because it exercises more of the
request and response handling stack. So instead of writing something like
get :index
to start the request, you would write get books_path
or similar.
One of the issues with using type: :request
is that you lose the ability to
# https://askubuntu.com/a/832534 | |
gsettings set org.cinnamon.settings-daemon.peripherals.touchpad touchpad-enabled true |
# Add this to a custom keyboard shortcut (recommended the pause/break) | |
amixer set Capture toggle | |
# reference: http://askubuntu.com/a/13364 |
require 'httparty' | |
# Este recurso tem como finalidade encontrar um endereço através de um CEP, e | |
# para isso ele utiliza o web service da Via Cep (http://viacep.com.br/) | |
# Obviamente, para utilizar este serviço é necessário uma conexão com a Internet. | |
# | |
# Como fazer a busca de endereço por cep? | |
# | |
# AddressFinder.cep(28053040) | |
# AddressFinder.cep('28053040') |
# Ajax testing with ruby and capybara | |
# | |
# Add this to spec/support | |
# | |
# When a link or button starts an ajax request, instead of use Capybara | |
# click_link, click_button and click_link_or_button methods use click_ajax_link, | |
# click_ajax_button and click_ajax_link_or_button methods. You can still use | |
# capybara methods and right after it, call wait_for_ajax method. | |
# | |
# This methods will wait until Capybara.default_max_wait_time for the ajax request |
module Select2Capybara | |
def select2(selector, value) | |
# on recent versions of select2, the .select2-focusser was replaced by | |
# .select2-input | |
execute_script("$('#{selector} .select2-focusser').val('#{value}')") | |
execute_script("$('#{selector} .select2-container').select2('open')") | |
wait_for_ajax | |
find('.select2-results li:first-child').click | |
end |
class String | |
def camelize | |
gsub(/(?:_([a-z]))|(^[a-z])/){"#{($1||$2).upcase}"} | |
end | |
def undercorize | |
gsub(/(.)([A-Z])/,'\1_\2').downcase | |
end | |
end |
class MyArray < Array | |
def initialize(array=[]) | |
super(self.class.ordenar(array)) | |
end | |
# Utilizando o algorítimo quicksort | |
def self.ordenar(array) | |
return array if array.size <=1 | |
pivot = array[0] |
//= require bootbox.min | |
// | |
// Open a confirm modal when click in a link. | |
// | |
// Dependencies: JQuery and http://bootboxjs.com | |
// | |
// Usage: | |
// | |
// Add attributes data-confirm-title and data-confirm-message to a link tag or |