spec/spec_helper.rb in rack-jetty-0.1.0 vs spec/spec_helper.rb in rack-jetty-0.2.0

- old
+ new

@@ -41,14 +41,14 @@ get = Net::HTTP::Get.new(path, header) get.basic_auth user, passwd if user && passwd http.request(get) { |response| @status = response.code.to_i - begin - @response = YAML.load(response.body) - rescue ArgumentError - @response = nil + if response.content_type == "text/yaml" + load_yaml(response) + else + @response = response end } } end @@ -63,8 +63,16 @@ http.request(post) { |response| @status = response.code.to_i @response = YAML.load(response.body) } } + end + + def load_yaml(response) + begin + @response = YAML.load(response.body) + rescue ArgumentError + @response = nil + end end end end \ No newline at end of file