Sha256: 51d393d1d5a14aa924d820e73e3d602f59bcff606b0328cd05cab16a8e839085
Contents?: true
Size: 1.55 KB
Versions: 4
Compression:
Stored size: 1.55 KB
Contents
# -*- coding: utf-8 -*- require 'spec_helper' require 'gemirro/cli' require 'gemirro/mirror_file' require 'slop' # Gemirro tests module Gemirro # CLI tests module CLI describe 'CLI' do include FakeFS::SpecHelpers it 'should return options' do options = CLI.options expect(options).to be_a(::Slop) expect(options.config[:strict]).to be_truthy expect(options.config[:banner]) .to eq('Usage: gemirro [COMMAND] [OPTIONS]') expect(options.to_s) .to match(/-v, --version(\s+)Shows the current version/) expect(options.to_s) .to match(/-h, --help(\s+)Display this help message./) version = options.fetch_option(:v) expect(version.short).to eq('v') expect(version.long).to eq('version') expect { version.call }.to output(/gemirro v.* on ruby/).to_stdout end it 'should retrieve version information' do expect(CLI.version_information).to eq( "gemirro v#{VERSION} on #{RUBY_DESCRIPTION}" ) end it 'should raise SystemExit if file does not exists' do CLI.should_receive(:abort) .with('The configuration file /config.rb does not exist') .and_raise SystemExit expect { CLI.load_configuration('config.rb') }.to raise_error SystemExit end it 'should raise LoadError if content isn\'t ruby' do file = MirrorFile.new('./config.rb') file.write('test') expect { CLI.load_configuration('config.rb') }.to raise_error LoadError end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
gemirro-0.6.0 | spec/gemirro/cli_spec.rb |
gemirro-0.5.0 | spec/gemirro/cli_spec.rb |
gemirro-0.4.0 | spec/gemirro/cli_spec.rb |
gemirro-0.3.0 | spec/gemirro/cli_spec.rb |