class CommunityZero::RSpec

Attributes

server[R]

Public Class Methods

method_missing(m, *args, &block) click to toggle source
# File lib/community_zero/rspec.rb, line 10
def self.method_missing(m, *args, &block)
  instance.send(m, *args, &block)
end
new() click to toggle source
# File lib/community_zero/rspec.rb, line 21
def initialize
  @server = Server.new(port: 3389)
end

Public Instance Methods

delete(path) click to toggle source
# File lib/community_zero/rspec.rb, line 48
def delete(path)
  request = Net::HTTP::Delete.new(path)
  http.request(request)
end
get(path) click to toggle source
# File lib/community_zero/rspec.rb, line 37
def get(path)
  request = Net::HTTP::Get.new(path)
  http.request(request)
end
post(path, body) click to toggle source
# File lib/community_zero/rspec.rb, line 42
def post(path, body)
  request = Net::HTTP::Post.new(path)
  request.set_form_data(body)
  http.request(request)
end
start() click to toggle source
# File lib/community_zero/rspec.rb, line 25
def start
  unless @server.running?
    @server.start_background
  end

  @server
end
uri() click to toggle source
# File lib/community_zero/rspec.rb, line 33
def uri
  @uri ||= URI.parse(url)
end

Private Instance Methods

http() click to toggle source
# File lib/community_zero/rspec.rb, line 55
def http
  @http ||= Net::HTTP.new(uri.host, uri.port)
end