Class: CommunityZero::RSpec

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Singleton
Defined in:
lib/community_zero/rspec.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRSpec

Returns a new instance of RSpec.



21
22
23
# File 'lib/community_zero/rspec.rb', line 21

def initialize
  @server = Server.new(port: 3389)
end

Instance Attribute Details

#serverObject (readonly)

Returns the value of attribute server.



19
20
21
# File 'lib/community_zero/rspec.rb', line 19

def server
  @server
end

Class Method Details

.method_missing(m, *args, &block) ⇒ Object



10
11
12
# File 'lib/community_zero/rspec.rb', line 10

def self.method_missing(m, *args, &block)
  instance.send(m, *args, &block)
end

Instance Method Details

#delete(path) ⇒ Object



48
49
50
51
# File 'lib/community_zero/rspec.rb', line 48

def delete(path)
  request = Net::HTTP::Delete.new(path)
  http.request(request)
end

#get(path) ⇒ Object



37
38
39
40
# File 'lib/community_zero/rspec.rb', line 37

def get(path)
  request = Net::HTTP::Get.new(path)
  http.request(request)
end

#post(path, body) ⇒ Object



42
43
44
45
46
# 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

#startObject



25
26
27
28
29
30
31
# File 'lib/community_zero/rspec.rb', line 25

def start
  unless @server.running?
    @server.start_background
  end

  @server
end

#uriObject



33
34
35
# File 'lib/community_zero/rspec.rb', line 33

def uri
  @uri ||= URI.parse(url)
end