lib/setsuzoku/rspec/dynamic_spec_helper.rb in setsuzoku-0.10.7 vs lib/setsuzoku/rspec/dynamic_spec_helper.rb in setsuzoku-0.10.8

- old
+ new

@@ -229,14 +229,19 @@ end def get_url_and_body(plugin, propz, stub_directory, action_name, url_params = nil) body = nil url = propz[:url] - format = propz[:request_format].to_s.include?('x-www-form') ? :json : propz[:request_format] + format = propz[:request_format].to_s.include?('x-www-form') || propz[:request_format] == :file ? :json : propz[:request_format] begin - body = if propz[:request_format] == :binary - JSON.parse(ERB.new(File.read("#{Dir.pwd}/spec/support/setsuzoku/#{stub_directory}/#{action_name}_request.json.erb"))) + body = if propz[:request_format] == :file + request_with_files = JSON.parse(ERB.new(File.read("#{Dir.pwd}/spec/support/setsuzoku/#{stub_directory}/#{action_name}_request.json.erb")).result) + request_with_files['files'].each do |k, path| + request_with_files[k] = File.new(path) + end + request_with_files.delete('files') + request_with_files else File.read("#{Dir.pwd}/spec/support/setsuzoku/#{stub_directory}/#{action_name}_request.#{format}") end body.squish! case format @@ -249,11 +254,9 @@ body.gsub!('{ ', '{') body.gsub!(' }', '}') end # We will convert these to url params when making requests. need to replicate that. - - req_params = case format when :json temp_body = JSON.parse(body) if url_params url_params.each{ |k,v| temp_body.delete(k.to_s) } \ No newline at end of file