Module: Dinja::RSpec

Defined in:
lib/dinja/rspec.rb

Instance Method Summary collapse

Instance Method Details

#dinja_mock!(key, *args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dinja/rspec.rb', line 5

def dinja_mock!(key, *args)
  mock = instance_double(key)

  allow_any_instance_of(Dinja::Container)
    .to receive(:resolve)
    .and_call_original

  allow_any_instance_of(Dinja::Container)
    .to receive(:resolve)
    .with(key, *args)
    .and_return mock

  mock
end