Sha256: be83df2393970e7cb20f45db93588086dd13c6bf9ea66f2b3ae129e317b28e11

Contents?: true

Size: 1.74 KB

Versions: 2

Compression:

Stored size: 1.74 KB

Contents

# frozen_string_literal: true

require "spec_helper"

module Fusuma
  module Plugin
    RSpec.describe Appmatcher do
      it "has a version number" do
        expect(Appmatcher::VERSION).not_to be nil
      end

      describe "#backend_klass" do
        subject { Appmatcher.backend_klass }
        context "when XDG_SESSION_TYPE is x11" do
          before { allow(Appmatcher).to receive(:xdg_session_type).and_return("x11") }
          it { is_expected.to eq Appmatcher::X11 }
        end

        context "when XDG_SESSION_TYPE is wayland" do
          before { allow(Appmatcher).to receive(:xdg_session_type).and_return("wayland") }

          context "when XDG_CURRENT_DESKTOP is ubuntu:GNOME" do
            before { allow(Appmatcher).to receive(:xdg_current_desktop).and_return("ubuntu:GNOME") }

            context "when gnome-extension is installed" do
              before do
                allow_any_instance_of(Appmatcher::GnomeExtensions::Installer).to receive(:installed?).and_return(true)
              end
              it { is_expected.to eq Appmatcher::GnomeExtension }
            end

            context "when gnome-extension is NOT installed" do
              before do
                allow_any_instance_of(Appmatcher::GnomeExtensions::Installer).to receive(:installed?).and_return(false)
              end
              it { is_expected.to eq Appmatcher::Gnome }
            end
          end

          context "when XDG_CURRENT_DESKTOP is UNKNOWN" do
            before do
              allow(Appmatcher).to receive(:xdg_current_desktop).and_return("UNKNOWN")
              allow(MultiLogger).to receive(:error)
            end
            it { is_expected.to eq Appmatcher::UnsupportedBackend }
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fusuma-plugin-appmatcher-0.6.0 spec/fusuma/plugin/appmatcher_spec.rb
fusuma-plugin-appmatcher-0.5.0 spec/fusuma/plugin/appmatcher_spec.rb