Skip to content

Instantly share code, notes, and snippets.

View redtachyons's full-sized avatar

Aboobacker MK redtachyons

View GitHub Profile
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
context "GET index" do
#context "POST create" do
#context "GET show" do
#context "PATCH update" do (or PUT update)
#context "DELETE destroy" do
#context "GET new" do
@redtachyons
redtachyons / ways_to_use_vcr.rb
Created April 25, 2017 12:24 — forked from myronmarston/ways_to_use_vcr.rb
Ways to use VCR for a request made by a let block
# 1) Use VCR.use_cassette in your let block. This will use
# the cassette just for requests made by creating bar, not
# for anything else in your test.
let(:foo) { VCR.use_cassette("foo") { create(:bar) } }
it "uses foo" do
foo
end
# 2) Wrap the it block that uses #foo in VCR.use_cassette.
@redtachyons
redtachyons / capybara cheat sheet
Created July 21, 2017 09:18 — forked from zhengjia/capybara cheat sheet
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')
@redtachyons
redtachyons / rubygc.md
Last active August 6, 2017 07:58
ruby gc

.

require 'rspec'
require 'prime'
class SocChallenge
def self.call(*args)
new(*args)
end
def initialize(number)
@number = number
@redtachyons
redtachyons / vcr.rb
Created September 7, 2017 04:17 — forked from just3ws/vcr.rb
VCR configuration that does a pretty good job of filtering out GitHub, Twitter, and LinkedIn keys.
VCR.configure do |c|
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
c.hook_into :webmock
c.ignore_localhost = true
c.default_cassette_options = { record: :new_episodes }
c.allow_http_connections_when_no_cassette = false
c.configure_rspec_metadata!
c.ignore_hosts 'codeclimate.com'
@redtachyons
redtachyons / SOLID.markdown
Created December 29, 2017 06:16 — forked from emaraschio/SOLID.markdown
SOLID Principles with ruby examples

#SOLID Principles with ruby examples

##SRP - Single responsibility principle A class should have only a single responsibility.

Every class should have a single responsibility, and that responsibility should be entirely encapsulated. All its services should be narrowly aligned with that responsibility, this embrace the high cohesion.

##OCP - Open/closed principle Software entities should be open for extension, but closed for modification.

@redtachyons
redtachyons / setup
Created June 26, 2018 08:12
postgres
sudo -u postgres psql postgres
\password postgres
\q
pg_hba.cong -> peer-> md5
@redtachyons
redtachyons / rails-rpush.md
Last active September 22, 2018 06:27 — forked from alameenkhader/rails-rpush.md
Rpush/Rails Integration

Follow the steps in rpush to add the gem to your rails project

PushNotificationDevice

rails g model PushNotificationDevice device_type:integer:index device_token:string
class CreatePushNotificationDevices < ActiveRecord::Migration