Follow the steps in rpush to add the gem to your rails project
rails g model PushNotificationDevice device_type:integer:index device_token:string
class CreatePushNotificationDevices < ActiveRecord::MigrationFollow the steps in rpush to add the gem to your rails project
rails g model PushNotificationDevice device_type:integer:index device_token:string
class CreatePushNotificationDevices < ActiveRecord::Migration| sudo -u postgres psql postgres | |
| \password postgres | |
| \q | |
| pg_hba.cong -> peer-> md5 |
#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.
| 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' |
| require 'rspec' | |
| require 'prime' | |
| class SocChallenge | |
| def self.call(*args) | |
| new(*args) | |
| end | |
| def initialize(number) | |
| @number = number |
.
| =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') |
| # 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. |
| 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 |