Skip to content

Instantly share code, notes, and snippets.

😊

Luján Fernaud lujanfernaud

😊
Block or report user

Report or block lujanfernaud

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@redrick
redrick / rspec_rails_cheetsheet.rb
Last active Aug 7, 2019 — forked from nerdinand/rspec_rails_cheetsheet.rb
New expect syntax + new hash syntax and couple corrections
View rspec_rails_cheetsheet.rb
#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)
@lawrencejones
lawrencejones / agg.coffee
Last active Mar 15, 2019
Projection generator for mongodb
View agg.coffee
_ = require 'underscore'
# Given an array of elements ELEM and a matching KEY value,
# will build the apprpriate projection to generate sortable
# weights for a mongo aggregator.
#
# ELEM: An array of values upon which to match against KEY
# KEY: The document field key to match against
# I: Default 0, index into array at which to begin
#
View capybara_cheat_sheet.md

Navigating

visit("/projects")
visit(post_comments_path(post))

Clicking links and buttons

View rspec3_config.md

Rails 4 with Rspec 3

Configure your Gemfile

# Gemfile
group :development, :test do
  gem 'rspec-rails', '~> 3.0.0'
  gem 'factory_girl_rails'
  gem 'capybara'
You can’t perform that action at this time.