Module: Colloquy::SpecHelpers

Defined in:
lib/colloquy/spec_helpers.rb

Overview

These are helper methods you might find useful when writing flow specs

Instance Method Summary collapse

Instance Method Details

#apply_chain(flow, *inputs) ⇒ Object



12
13
14
15
16
# File 'lib/colloquy/spec_helpers.rb', line 12

def apply_chain(flow, *inputs)
  inputs.map do |input|
    flow.apply(input)
  end
end

#state_for(flow) ⇒ Object



18
19
20
# File 'lib/colloquy/spec_helpers.rb', line 18

def state_for(flow)
  flow.send(:state)
end

#stub_mysql!Object



5
6
7
8
9
10
# File 'lib/colloquy/spec_helpers.rb', line 5

def stub_mysql!
  allow(ActiveRecord::Base).to receive(:establish_connection)
  allow(Colloquy::Helpers::MySQL::MySQLProxy).to receive(:instance).and_return(
    double('MySQLProxy', configure: nil, configuration: {})
  )
end