diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-17 12:12:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-17 12:12:03 +0300 |
commit | 550096a3bf94b5d8e2b74dc8f94fbb0c579a7313 (patch) | |
tree | ca0d548e9a1c369df1a07a60ef0a26503653e00e /spec/presenters | |
parent | 600cd0747bbb2c1f089785572a159cce6c4ce806 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/presenters')
-rw-r--r-- | spec/presenters/vs_code/settings/vs_code_manifest_presenter_spec.rb | 35 | ||||
-rw-r--r-- | spec/presenters/vs_code/settings/vs_code_setting_presenter_spec.rb | 43 |
2 files changed, 78 insertions, 0 deletions
diff --git a/spec/presenters/vs_code/settings/vs_code_manifest_presenter_spec.rb b/spec/presenters/vs_code/settings/vs_code_manifest_presenter_spec.rb new file mode 100644 index 00000000000..6b39e3dbbf6 --- /dev/null +++ b/spec/presenters/vs_code/settings/vs_code_manifest_presenter_spec.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe VsCode::Settings::VsCodeManifestPresenter, feature_category: :web_ide do + let(:settings) { [] } + + subject(:presenter) { described_class.new(settings) } + + describe '#latest' do + context 'when there are not persisted settings' do + it 'includes default machine uuid' do + default_machine = ::VsCode::Settings::DEFAULT_MACHINE + + expect(presenter.latest.length).to eq(1) + expect(presenter.latest['machines']).to eq(default_machine[:uuid]) + end + end + + context 'when there are persisted settings' do + let(:settings) { [build_stubbed(:vscode_setting, setting_type: 'extensions')] } + + it 'includes the persisted setting uuid' do + expect(presenter.latest.length).to eq(2) + expect(presenter.latest['extensions']).to eq(settings.first.uuid) + end + end + end + + describe '#session' do + it 'returns default session' do + expect(presenter.session).to eq(::VsCode::Settings::DEFAULT_SESSION) + end + end +end diff --git a/spec/presenters/vs_code/settings/vs_code_setting_presenter_spec.rb b/spec/presenters/vs_code/settings/vs_code_setting_presenter_spec.rb new file mode 100644 index 00000000000..8ad95156bf0 --- /dev/null +++ b/spec/presenters/vs_code/settings/vs_code_setting_presenter_spec.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe VsCode::Settings::VsCodeSettingPresenter, feature_category: :web_ide do + subject(:presenter) { described_class.new(setting) } + + context "when presenting default machine" do + let(:setting) { VsCode::Settings::DEFAULT_MACHINE } + + describe '#content' do + it { expect(presenter.content).to be_nil } + end + + describe '#machines' do + it { expect(presenter.machines).to eq(VsCode::Settings::DEFAULT_MACHINE[:machines]) } + end + + describe '#machine_id' do + it { expect(presenter.machine_id).to be_nil } + end + end + + context "when presenting persisted setting" do + let(:setting) { build_stubbed(:vscode_setting, setting_type: 'extensions') } + + describe '#content' do + it { expect(presenter.content).to eq(setting.content) } + end + + describe '#machines' do + it { expect(presenter.machines).to be_nil } + end + + describe '#machine_id' do + it { expect(presenter.machine_id).to eq(VsCode::Settings::DEFAULT_MACHINE[:uuid]) } + end + + describe 'version' do + it { expect(presenter.version).to eq(setting.version) } + end + end +end |