Sha256: 7f08025fcec5e0679775fdf1fc560562bf07dd5ac54c064dcfb88cd990d066fa

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

module Firebrew::Firefox
  describe Command do
    subject do
      Command.new(self.config, self.executer)
    end
    
    let(:config){Firebrew::Runner.default_config}
    let(:executer){Command::Executer.new}
    
    context 'when the indicated firefox command by the `config[:firefox]` not existed' do
      let(:config){super().merge firefox: 'firefox/not/existed/path'}
      it { expect{subject}.to raise_error(Firebrew::FirefoxCommandError, 'Firefox command not found: firefox/not/existed/path') }
    end
    
    context 'when the indicated command by the `config[:firefox]` was not firefox' do
      let(:executer) do
        double('executer', exec: ['Other program', 0])
      end
      it { expect{subject}.to raise_error(Firebrew::FirefoxCommandError, 'Command is not Firefox: %{firefox}' % self.config) }
      
      describe 'command status' do
        let(:executer) do
          double('executer', exec: ['Fake Mozilla Firefox', 1])
        end
        it { expect{subject}.to raise_error(Firebrew::FirefoxCommandError, 'Command is not Firefox: %{firefox}' % self.config) }
      end
    end
    
    describe '#version()' do
      subject { super().version }
      let(:executer) do
        double('executer', exec: ['Mozilla Firefox 30.0', 0])
      end
      it { is_expected.to eq('30.0') }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
firebrew-0.3.0 spec/firebrew/firefox/command_spec.rb
firebrew-0.2.0 spec/firebrew/firefox/command_spec.rb