Skip to content

Instantly share code, notes, and snippets.

Avatar
🦋
we renamed master to main. step 2: get the state to stop killing black&brown ppl

Brenda Wallace Br3nda

🦋
we renamed master to main. step 2: get the state to stop killing black&brown ppl
View GitHub Profile
View capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@Br3nda
Br3nda / registrations_controller.rb
Created Feb 9, 2017 — forked from jwo/registrations_controller.rb
API JSON authentication with Devise
View registrations_controller.rb
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@Br3nda
Br3nda / rspec_rails_cheetsheet.rb
Created Sep 19, 2016 — forked from them0nk/rspec_rails_cheetsheet.rb
Rspec Rails cheatsheet (include capybara matchers)
View rspec_rails_cheetsheet.rb
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)