Related cards:
Rspec + Capybara + Rails4 + Spork (intergation tests setup with selenium and poltergeist)
Add in Gemfile:
group :development, :test do
gem 'rspec-rails'
gem 'spork-rails'
end
group :test do
gem 'capybara'
gem 'database_cleaner'
gem 'email_spec'
gem 'poltergeist'
gem 'launchy'
gem 'selenium-webdriver'
end
Run ...
ubuntu nginx with txid module
To install nginx with txid module
install nginx-full package:
sudo apt-get install nginx-full
download last nginx source:
wget http://nginx.org/download/nginx-1.9.9.tar.gz
examine what ...
Setting up Javascript environment with NVM on Ubuntu 14.04
NVM provides you more convenient way to manage and set up your Javascript(Node.js) environment.
First install NVM, note git
must be installed on your sistem:
^
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git check...
How to create Nokogiri node if node name collide with Nokogiri::XML::Builder methods
Suppose you want to create node with name text
, but this method already present in Nokogiri::XML::Builder. The solution is to add underscore after node name:
Nokogiri::XML::Builder.new do |xml|
xml.text_ 'something' # this should create n...
Javascript with Turbolinks in Rails 4
If some of your scripts don't work with turbolinks, you should do the following:
ready = ->
#your code here
$(document).ready(ready)
$(document).on('page:load', ready)
Install gems without those which in production group
For that purpose, just use these command:
bundle install --without production
Get node's parent element with Capybara
To get parent of Capybara's node do the following:
node = page.find '#selector'
parent = node.find(:xpath, '..')
parent_of_parent = node.find(:xpath, '../..')
Rails migration add float point field with scale and precision
class CreateFakes < ActiveRecord::Migration
def change
create_table :fakes do |t|
t.decimal :float_value, :precision => 4, :scale => 3
end
end
end
This will allow you to have 3 digits after the decimal point and 4 digits ...
Deploy rails apps with capistrano
Install capistrano:
add to Gemfile
group :development do
gem 'capistrano'
gem 'rvm-capistrano'
end
Then cd to project root folder and run:
bundle install
capify .
setup your config/deploy.rb
file, [here some u...
Reset RabbitMQ (Manjaro linux)
To reset RabbitMQ Mnesia database ensure that RabbitMQ process is running on your system. Then stop the running application:
sudo rabbitmqctl stop_app
After that run the command:
sudo rabbitmqctl reset
And then start the app:
`...