Top Level Namespace

Defined Under Namespace

Modules: Capistrano, Slnky Classes: DeepStruct

Instance Method Summary collapse

Instance Method Details

#slnky_command(name) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/slnky/spec/helper.rb', line 17

def slnky_command(name)
  @commands ||= {}
  @commands[name] ||= begin
    file = File.expand_path("#{Dir.pwd}/test/commands/#{name}.json", __FILE__)
    raise "file #{file} not found" unless File.exists?(file)
    Slnky::Command::Request.new(JSON.parse(File.read(file)))
  end
end

#slnky_event(name) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/slnky/spec/helper.rb', line 8

def slnky_event(name)
  @events ||= {}
  @events[name] ||= begin
    file = File.expand_path("#{Dir.pwd}/test/events/#{name}.json", __FILE__)
    raise "file #{file} not found" unless File.exists?(file)
    Slnky::Message.new(JSON.parse(File.read(file)))
  end
end

#slnky_response(route, service) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/slnky/spec/helper.rb', line 26

def slnky_response(route, service)
  @responses ||= {}
  @responses[route] ||= begin
    response = Slnky::Command::Response.new(route, service)
    response.exchange = Slnky::Transport::MockExchange.new
    response
  end
end