Add support for allprop and propname

This commit is contained in:
Brandon Robins
2018-01-30 22:59:55 -06:00
parent 13b5dbc989
commit 9f21799206
4 changed files with 203 additions and 37 deletions

View File

@@ -0,0 +1,59 @@
# frozen_string_literal: false
require 'rails_helper'
require 'support/request_helpers'
require 'support/examples/propfind'
require 'support/examples/proppatch'
RSpec.describe 'PROPFIND', type: :request do
before(:all) do
tmp_dir = Rails.root.join('../../tmp').to_path
Dir.mkdir tmp_dir unless File.exists? tmp_dir
webdav_dir = Rails.root.join('../../tmp/webdav').to_path
FileUtils.rm_r webdav_dir if File.exists? webdav_dir
Dir.mkdir webdav_dir
end
before(:each) do
allow(Calligraphy).to receive(:enable_digest_authentication)
.and_return(false)
end
context 'with xml defintiion' do
before(:each) do
put '/webdav/bar.html', headers: {
RAW_POST_DATA: 'hello world'
}
proppatch '/webdav/bar.html', headers: {
RAW_POST_DATA: Support::Examples::Proppatch.rfc4918_9_2_2
}
end
describe 'allprop' do
it 'returns all property names and values' do
propfind '/webdav/bar.html', headers: {
RAW_POST_DATA: Support::Examples::Propfind.allprop
}
expect(response.status).to eq(207)
expect(response.body).to include('Authors')
expect(response.body).to include('Author>')
expect(response.body).to include('Jim')
expect(response.body).to include('Roy')
end
end
describe 'propname' do
it 'returns all property names' do
propfind '/webdav/bar.html', headers: {
RAW_POST_DATA: Support::Examples::Propfind.propname
}
expect(response.status).to eq(207)
expect(response.body).to include('Authors/')
expect(response.body).to_not include('Author/')
end
end
end
end