Skip to content

Instantly share code, notes, and snippets.

View floodico's full-sized avatar
🌶️

Sviatoslav Flud floodico

🌶️
View GitHub Profile
@floodico
floodico / chat_rooms.coffee
Created July 5, 2017 23:11
user is typing feature
jQuery(document).on 'turbolinks:load', ->
u = $("#current_user").val()
window.current_user = JSON.parse(u)
messages = $('#messages')
user_is_typing = $('#user_is_typing')
App.global_chat = App.cable.subscriptions.create {
channel: "ChatRoomsChannel"
chat_room_id: messages.data('chat-room-id')
},
require 'rails_helper'
RSpec.describe 'Comments API', type: :request do
let!(:post) { create(:post) }
let!(:comments) { create_list(:comment, 20, post_id: post.id) }
let(:post_id) { post.id }
let(:id) { comments.first.id }
describe 'POST /posts/:post_id/comments' do
let(:valid_attributes) { { body: 'Hello Body' } }