Class: CommunityZero::RSpec
- Inherits:
-
Object
- Object
- CommunityZero::RSpec
- Extended by:
- Forwardable
- Includes:
- Singleton
- Defined in:
- lib/community_zero/rspec.rb
Instance Attribute Summary collapse
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Class Method Summary collapse
Instance Method Summary collapse
- #delete(path) ⇒ Object
- #get(path) ⇒ Object
-
#initialize ⇒ RSpec
constructor
A new instance of RSpec.
- #post(path, body) ⇒ Object
- #start ⇒ Object
- #uri ⇒ Object
Constructor Details
Instance Attribute Details
#server ⇒ Object (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 |
#start ⇒ Object
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 |
#uri ⇒ Object
33 34 35 |
# File 'lib/community_zero/rspec.rb', line 33 def uri @uri ||= URI.parse(url) end |