Add support for allprop and propname
This commit is contained in:
59
spec/requests/propfind_spec.rb
Normal file
59
spec/requests/propfind_spec.rb
Normal 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
|
||||
Reference in New Issue
Block a user