Sha256: 55e8da283e329f3577d3ab7df743396c4a332264ed6250ab51f5d06c3b411f5d

Contents?: true

Size: 1.58 KB

Versions: 1

Compression:

Stored size: 1.58 KB

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'fakefs/spec_helpers'
require 'gtk3'
require 'volay/app'
require 'volay/utils'
require 'volay/widget/events'
require 'volay/widget/system_tray'
require 'volay/widget/volume_control'
require 'volay/mixer/default'
require 'volay/mixer/alsa'
require 'volay/exceptions'

describe 'Volay::App' do
  include FakeFS::SpecHelpers

  context '#events' do
    it 'should return alsa' do
      allow_any_instance_of(Volay::App).to receive(:initialize_mixer)
      allow_any_instance_of(Volay::App).to receive(:initialize_ui)
      allow_any_instance_of(Volay::Utils).to receive(:update_status_icon)
      allow_any_instance_of(Volay::App).to receive(:connect_signals)
        .and_yield('on_status_icon_button_press_event')

      File.write('something', '')
      app = Volay::App.new('something')
      expect(app.signals_list).to be_a(Hash)
    end
  end

  context '#ui' do
    it 'should return alsa' do
      allow_any_instance_of(Volay::App).to receive(:initialize_mixer)
      allow_any_instance_of(Volay::App).to receive(:initialize_events)

      xml = <<-XML
  <?xml version="1.0" encoding="UTF-8"?>
  <!-- Generated with glade 3.18.3 -->
  <interface>
    <requires lib="gtk+" version="3.2"/>
    <object class="GtkIconFactory" id="icon_factory">
      <sources>
    <source stock-id="volume-muted" filename="/glade/icons/volume-muted.png"/>
      </sources>
    </object>
  </interface>
XML

      File.write('something', xml)
      app = Volay::App.new('something')
      expect(app.get_object('icon_factory')).to be_a(Gtk::IconFactory)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
volay-1.2.0 spec/volay/app_spec.rb