Commit 75232f92 authored by Mark Chao's avatar Mark Chao

Mark proxy_class_name as private

Add spec for repository proxying
parent 8ab995da
......@@ -19,6 +19,8 @@ module Elastic
end
end
private
def proxy_class_name
"#{@data_class.name}ClassProxy"
end
......
......@@ -12,6 +12,8 @@ module Elastic
generate_forwarding
end
private
def proxy_class_name
"#{@data_class.name}InstanceProxy"
end
......
......@@ -12,6 +12,20 @@ describe Elastic::MultiVersionClassProxy do
expect(result).to be_a(Elastic::V12p1::SnippetClassProxy)
expect(result.target).to eq(ProjectSnippet)
end
context 'repository' do
it 'returns class proxy in specified version' do
repository_proxy = described_class.new(Repository)
repository_result = repository_proxy.version('V12p1')
wiki_proxy = described_class.new(ProjectWiki)
wiki_result = wiki_proxy.version('V12p1')
expect(repository_result).to be_a(Elastic::V12p1::RepositoryClassProxy)
expect(repository_result.target).to eq(Repository)
expect(wiki_result).to be_a(Elastic::V12p1::ProjectWikiClassProxy)
expect(wiki_result.target).to eq(ProjectWiki)
end
end
end
describe 'method forwarding' do
......
......@@ -14,6 +14,24 @@ describe Elastic::MultiVersionInstanceProxy do
expect(result).to be_a(Elastic::V12p1::SnippetInstanceProxy)
expect(result.target).to eq(snippet)
end
context 'repository' do
let(:project) { create(:project, :repository) }
let(:repository) { project.repository }
let(:wiki) { project.wiki }
it 'returns instance proxy in specified version' do
repository_proxy = described_class.new(repository)
repository_result = repository_proxy.version('V12p1')
wiki_proxy = described_class.new(wiki)
wiki_result = wiki_proxy.version('V12p1')
expect(repository_result).to be_a(Elastic::V12p1::RepositoryInstanceProxy)
expect(repository_result.target).to eq(repository)
expect(wiki_result).to be_a(Elastic::V12p1::ProjectWikiInstanceProxy)
expect(wiki_result.target).to eq(wiki)
end
end
end
describe 'method forwarding' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment