Skip to content

Instantly share code, notes, and snippets.

@demetrios
demetrios / rspec_rails_cheetsheet.rb
Created October 23, 2018 06:34 — forked from redrick/rspec_rails_cheetsheet.rb
New expect syntax + new hash syntax and couple corrections
#Model
expect(@user).to have(1).error_on(:username) # Checks whether there is an error in username
expect(@user.errors[:username]).to include("can't be blank") # check for the error message
#Rendering
expect(response).to render_template(:index)
#Redirecting
expect(response).to redirect_to(movies_path)
@demetrios
demetrios / gist:5912662
Last active December 19, 2015 06:39
'rvm get head' problems with multi-user RVM installation
$ rvm get head
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13525 100 13525 0 0 12763 0 0:00:01 0:00:01 --:--:-- 162k
Downloading RVM from wayneeseguin branch master
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1071k 100 1071k 0 0 233k 0 0:00:04 0:00:04 --:--:-- 276k
Upgrading the RVM installation in /usr/local/rvm/
@demetrios
demetrios / gist:5911365
Created July 2, 2013 17:35
'rvm get stable' shat all over my console
heli:~ admin$ rvm -v
rvm 1.21.2 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
heli:~ ladmin$ rvm get stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13478 100 13478 0 0 4862 0 0:00:02 0:00:02 --:--:-- 4862
Downloading RVM from wayneeseguin branch stable
% Total % Received % Xferd Average Speed Time Time Time Current
$ rvm all --verbose do gem env gemhome
ruby-1.9.2-p0: ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
/Users/mbd2/.rvm/gems/ruby-1.9.2-p0
ruby-1.9.2-p136: ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0]
/Users/mbd2/.rvm/gems/ruby-1.9.2-p136
Gemset '' does not exist, 'rvm gemset create ' first, or append '--create'.
ruby-1.9.2-p290: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
/Users/mbd2/.rvm/gems/ruby-1.9.2-p290
ruby-1.9.2-rc2: ruby 1.9.2dev (2010-07-11 revision 28618) [x86_64-darwin10.4.0]
/Users/mbd2/.rvm/gems/ruby-1.9.2-rc2
@demetrios
demetrios / rvm requirements (autolibs enabled)
Created May 10, 2013 21:37
rvm requirements with autolibs enabled
$ rvm requirements
Installing requirements for osx, might require sudo password.
Cloning into '/usr/local/Library/Taps/homebrew-dupes'...
remote: Counting objects: 892, done.
remote: Compressing objects: 100% (486/486), done.
remote: Total 892 (delta 492), reused 793 (delta 406)
Receiving objects: 100% (892/892), 154.47 KiB, done.
Resolving deltas: 100% (492/492), done.
Tapped 42 formula
Checking out files: 100% (1246/1246), done.
@demetrios
demetrios / rvm --debug requirements (read-fail)
Last active December 17, 2015 05:28
rvm requirements with autolibs set to read-fail
$ rvm --debug requirements
rvm_autolibs_flag=read-fail
Installing requirements for osx, might require sudo password.
requirements code for osx loaded
Found required packages: autoconf, automake, libtool, pkg-config, libyaml, readline, libxml2, libxslt, libksba, sqlite, openssl.
Skipping installation, make sure listed packages are installed.
RVM autolibs is now configured with mode '2' => 'check and stop if missing',
please run `rvm autolibs enable` to let RVM do its job or run and read `rvm autolibs [help]`
or visit https://rvm.io/rvm/autolibs for more information.
__rvm_rm_rf already gone: /usr/local/rvm/tmp/38402*
@demetrios
demetrios / rvm --trace requirements output
Created May 10, 2013 20:59
RVM requirements unexpectedly asking for password
$ rvm --trace requirements ruby-2.0.0
+ [[ -n '' ]]
+ set -o errtrace
+ export 'PS4=+ $(date "+%s.%N") ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ PS4='+ $(date "+%s.%N") ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ 1368219187.N /scripts/cli : __rvm_parse_args() 709 > [[ -z '' ]]
+ 1368219187.N /scripts/cli : __rvm_parse_args() 709 > [[ -n '' ]]
+ 1368219187.N /scripts/cli : __rvm_parse_args() 712 > [[ error == '' ]]
+ 1368219187.N /scripts/cli : __rvm_parse_args() 712 > [[ 0 -eq 1 ]]
+ 1368219187.N /scripts/cli : __rvm_parse_args() 712 > [[ -n '' ]]
@demetrios
demetrios / curling attachment
Created September 12, 2012 15:46
curl response from elasticsearch
$ curl -X GET "http://localhost:9200/testapp_development_reports/report/_search?load=true&pretty=true" -d '{query":{"query_string":{"query":"contains","default_operator":"AND"}},"highlight":{"fields":{"attachment":{}}}}'
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
@demetrios
demetrios / gist:1112871
Created July 29, 2011 00:14
Application Trace
Application Trace:
app/views/posts/_form.html.haml:25:in `block in _app_views_posts__form_html_haml___3252204871371051419_2186810440'
app/views/posts/_form.html.haml:1:in `_app_views_posts__form_html_haml___3252204871371051419_2186810440'
app/views/posts/new.html.haml:3:in `_app_views_posts_new_html_haml___3925115510830348758_2188475320'
app/controllers/posts_controller.rb:56:in `block (2 levels) in create'
app/controllers/posts_controller.rb:51:in `create'
Framework Trace: