Module: Gritz::Testing::Rspec
- Defined in:
- /home/runner/work/gritz/gritz/sources/gritz-core/lib/gritz/testing/rspec.rb
Overview
Requiring gritz/testing/rspec enables type: :rpc controller tests.
Class Method Summary collapse
Class Method Details
.install ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File '/home/runner/work/gritz/gritz/sources/gritz-core/lib/gritz/testing/rspec.rb', line 12 def self.install ::RSpec.configure { |config| config.include RpcHelper, type: :rpc } ::RSpec::Matchers.define :raise_rpc_error do |code| supports_block_expectations match do |block| @error = nil begin block.call false rescue Gritz::Error => e @error = e e.code == code.to_sym end end do "expected RPC error #{code}, got #{@error ? @error.code : 'no error'}" end do "expected no RPC error #{code}, got #{@error.code}" end end end |