Skip to content

Instantly share code, notes, and snippets.

View DmitryBash's full-sized avatar

Batracov Dmitrii DmitryBash

  • Netherlands
View GitHub Profile
http://merle-amber.blogspot.com/2008/09/mock.html
https://vasily.polovnyov.ru/posts/double-mock-stub.html
https://habr.com/post/169381/
http://rubyblog.pro/2017/10/rspec-difference-between-mocks-and-stubs
https://relishapp.com/rspec/rspec-mocks/docs/basics/partial-test-doubles
http://lazybios.com/2016/08/rspec-expectations-cheat-sheet/
https://vasily.polovnyov.ru/posts/double-mock-stub.html
https://vasily.polovnyov.ru/posts/describe-vs-context.html
https://relishapp.com/rspec/rspec-mocks/v/2-99/docs/method-stubs
https://stackoverflow.com/questions/39626805/passing-parameters-to-an-rspec-shared-example
@DmitryBash
DmitryBash / test_channel_spec.rb
Created October 15, 2018 07:37 — forked from tomekw/test_channel_spec.rb
Unit testing ActionCable channels with RSpec
# app/channels/hello_channel.rb
class HelloChannel < ActionCable::Channel::Base
def say_hello(data)
times_to_say_hello = data.fetch("times_to_say_hello")
hello = "Hello, #{current_profile.name}!"
times_to_say_hello.times do
ActionCable.server.broadcast(current_profile.id, hello)
end
end

Setup

Replace IRB with Pry (in your Gemfile) and Byebug with pry-byebug.

gem 'pry-rails', group: [:development, :test]
gem 'pry-byebug', group: [:development, :test]

Using PRY

class C
def self.no_dot
puts "Self is #{self}"
end
self.no_dot
no_dot
end
#Не особо понимаю разницу между вызовом просто no_dot и self.no_dot