spec/ rubocopied

This commit is contained in:
erwanlr
2013-01-24 22:00:17 +01:00
parent 3094d31633
commit b919c12d2f
39 changed files with 1789 additions and 1675 deletions

View File

@@ -1,14 +1,16 @@
require "spec_helper"
# encoding: UTF-8
require 'spec_helper'
class TestPlugin < Plugin
def initialize
register_options(["-u", "--url"])
register_options(['-u', '--url'])
end
end
class AnotherPlugin < Plugin
def initialize
super(:author => "John")
super(author: 'John')
# No Options
end
end
@@ -19,28 +21,28 @@ describe Plugins do
let(:test_plugin) { TestPlugin.new }
let(:another_plugin) { AnotherPlugin.new }
describe "#new" do
context "without argument" do
describe '#new' do
context 'without argument' do
its(:option_parser) { should be_a CustomOptionParser }
it "should be an Array" do
it 'should be an Array' do
plugins.should be_an Array
end
end
context "with an option_parser argument" do
subject(:plugin) { Plugins.new(CustomOptionParser.new("the banner")) }
context 'with an option_parser argument' do
subject(:plugin) { Plugins.new(CustomOptionParser.new('the banner')) }
its(:option_parser) { should be_a CustomOptionParser }
its("option_parser.banner") { should === "the banner" }
its('option_parser.banner') { should === 'the banner' }
it "should raise an eror if the parser is not an instance of CustomOptionParser" do
expect { Plugins.new(OptionParser.new) }.to raise_error("The parser must be an instance of CustomOptionParser, OptionParser supplied")
it 'should raise an eror if the parser is not an instance of CustomOptionParser' do
expect { Plugins.new(OptionParser.new) }.to raise_error('The parser must be an instance of CustomOptionParser, OptionParser supplied')
end
end
end
describe "#register_plugin" do
describe '#register_plugin' do
after :each do
if @exception
expect { plugins.register_plugin(@plugin) }.to raise_error(@exception)
@@ -51,27 +53,27 @@ describe Plugins do
end
end
context "when the argument supplied is not an instance of Plugin" do
it "should raise an error" do
@plugin = "I'am a String"
@exception = "The argument must be an instance of Plugin, String supplied"
context 'when the argument supplied is not an instance of Plugin' do
it 'should raise an error' do
@plugin = "I'am a String"
@exception = 'The argument must be an instance of Plugin, String supplied'
end
end
it "should register the plugin" do
it 'should register the plugin' do
@plugin = TestPlugin.new
@expected = [@plugin]
end
it "should register 2 plugins (the order is important)" do
it 'should register 2 plugins (the order is important)' do
plugins.register_plugin(test_plugin)
@plugin = another_plugin
@plugin = another_plugin
@expected = [test_plugin, @plugin]
end
end
describe "#register" do
describe '#register' do
after :each do
plugins.register(*@plugins_to_register)
@@ -83,11 +85,11 @@ describe Plugins do
plugins.should === @plugins_to_register
end
it "should register 1 plugin" do
it 'should register 1 plugin' do
@plugins_to_register = [test_plugin]
end
it "should register 2 plugins" do
it 'should register 2 plugins' do
@plugins_to_register = [another_plugin, test_plugin]
end
end