Sha256: deb8224429f0a2dc2f40d597acf67080e3c61a28974e884c982d9e5640ddc292

Contents?: true

Size: 682 Bytes

Versions: 7

Compression:

Stored size: 682 Bytes

Contents

require_relative '../spec_helper'
require 'cliutils/messaging'
require 'cliutils/prefs/pref_actions/pref_action'
require 'cliutils/prefs/pref_actions/open_url_action'

describe CLIUtils::OpenUrlAction do
  it 'opens a website with the specified parameter' do
    a = CLIUtils::OpenUrlAction.new
    a.parameters = { url: 'http://www.google.com' }
    expect(Launchy).to receive(:open).with('http://www.google.com')
    a.run
  end

  it 'throws an exception with a bad URL' do
    a = CLIUtils::OpenUrlAction.new
    a.parameters = { url: 'bachya' }
    m = "Failed to open URL: No application found to handle 'bachya'"
    expect { a.run }.to raise_error(RuntimeError, m)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cliutils-2.2.6 spec/action/open_url_action_spec.rb
cliutils-2.2.5 spec/action/open_url_action_spec.rb
cliutils-2.2.4 spec/action/open_url_action_spec.rb
cliutils-2.2.3 spec/action/open_url_action_spec.rb
cliutils-2.2.2 spec/action/open_url_action_spec.rb
cliutils-2.2.1 spec/action/open_url_action_spec.rb
cliutils-2.2.0 spec/action/open_url_action_spec.rb