diff options
Diffstat (limited to 'spec/lib/gitlab/static_site_editor/config_spec.rb')
-rw-r--r-- | spec/lib/gitlab/static_site_editor/config_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/lib/gitlab/static_site_editor/config_spec.rb b/spec/lib/gitlab/static_site_editor/config_spec.rb new file mode 100644 index 00000000000..dea79fb0e92 --- /dev/null +++ b/spec/lib/gitlab/static_site_editor/config_spec.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Gitlab::StaticSiteEditor::Config do + subject(:config) { described_class.new(repository, ref, file_path, return_url) } + + let(:project) { create(:project, :public, :repository, name: 'project', namespace: namespace) } + let(:namespace) { create(:namespace, name: 'namespace') } + let(:repository) { project.repository } + let(:ref) { 'master' } + let(:file_path) { 'README.md' } + let(:return_url) { 'http://example.com' } + + describe '#payload' do + subject { config.payload } + + it 'returns data for the frontend component' do + is_expected.to eq( + branch: 'master', + commit: repository.commit.id, + namespace: 'namespace', + path: 'README.md', + project: 'project', + project_id: project.id, + return_url: 'http://example.com' + ) + end + end +end |