spec/firebrew/runner_spec.rb in firebrew-0.2.0 vs spec/firebrew/runner_spec.rb in firebrew-0.3.0
- old
+ new
@@ -1,16 +1,15 @@
require 'spec_helper'
+require 'os'
module Firebrew
describe Firebrew::Runner do
- describe '::default_config(platform)' do
+ describe '::default_config' do
subject do
- Runner.default_config(self.platform)
+ Runner.default_config
end
- let(:platform){'x86_64-darwin13.0'}
-
before do
ENV['FIREBREW_FIREFOX_PROFILE_BASE_DIR'] = nil
ENV['FIREBREW_FIREFOX_PROFILE'] = nil
ENV['FIREBREW_FIREFOX'] = nil
end
@@ -19,37 +18,31 @@
ENV['FIREBREW_FIREFOX_PROFILE_BASE_DIR'] = nil
ENV['FIREBREW_FIREFOX_PROFILE'] = nil
ENV['FIREBREW_FIREFOX'] = nil
end
- context 'when the `platform` was "MacOS"' do
- let(:platform){'x86_64-darwin13.0'}
+ if OS.mac? then
it do
is_expected.to eq(
base_dir: '~/Library/Application Support/Firefox',
firefox: '/Applications/Firefox.app/Contents/MacOS/firefox-bin',
profile: 'default',
os: 'darwin'
)
end
- end
-
- context 'when the `platform` was "Linux"' do
- let(:platform){'x86_64-linux'}
+
+ elsif OS.linux? then
it do
is_expected.to eq(
base_dir: '~/.mozilla/firefox',
firefox: '/usr/bin/firefox',
profile: 'default',
os: 'linux'
)
end
- end
-
- context 'when the `platform` was "Windows"' do
- let(:platform){'x64-mingw32'}
+ elsif OS.windows? then
before do
ENV['APPDATA'] = nil
ENV['PROGRAMFILES'] = nil
ENV['PROGRAMFILES(X86)'] = nil
end
@@ -121,17 +114,14 @@
ENV['FIREBREW_FIREFOX_PROFILE_BASE_DIR'] = 'path/to/profile_base_directory'
ENV['FIREBREW_FIREFOX_PROFILE'] = 'profile-name'
ENV['FIREBREW_FIREFOX'] = 'path/to/firefox'
end
- it do
- is_expected.to eq(
- base_dir: 'path/to/profile_base_directory',
- firefox: 'path/to/firefox',
- profile: 'profile-name',
- os: 'darwin'
- )
+ it 'should set the default_config' do
+ expect(subject[:base_dir]).to eq('path/to/profile_base_directory')
+ expect(subject[:firefox]).to eq('path/to/firefox')
+ expect(subject[:profile]).to eq('profile-name')
end
end
end
describe :Instance do
@@ -139,10 +129,10 @@
let(:instance) do
Runner.new(
base_dir: './tmp',
data_file: 'profiles.ini',
- firefox: ENV['OS'].nil? ? './spec/double/firefox.rb' : './spec/double/firefox.bat'
+ firefox: OS.windows? ? './spec/double/firefox.bat' : './spec/double/firefox.rb'
)
end
let(:search_params){{term: 'hoge', version: '30.0', max: 1, os: Runner.default_config[:os]}}