Sha256: d2d3922dbc213c000e0afe939a7ca9961752a71bea3b452700a5446c734a4eff
Contents?: true
Size: 1.21 KB
Versions: 15
Compression:
Stored size: 1.21 KB
Contents
require 'spec_helper' describe MB::Cli::SubCommand do subject { described_class } describe "::new" do context "given a MB::Plugin" do let(:metadata) do double('metadata', name: "rspec-test" ) end let(:plugin) { MB::Plugin.new(metadata) } it "returns an anonymous class whose superclass is MB::Cli::SubCommand::Plugin" do klass = subject.new(plugin) klass.should be_a(Class) klass.superclass.should eql(MB::Cli::SubCommand::Plugin) end end context "given a MB::Component" do let(:plugin) { double('plugin') } let(:component) { MB::Component.new(plugin, plugin) } it "returns an anonymous class whose superclass is MB::Cli::SubCommand::Component" do klass = subject.new(component) klass.should be_a(Class) klass.superclass.should eql(MB::Cli::SubCommand::Component) end end context "given a class which is not a MB::Plugin or MB::Component" do it "raises an ArgumentError" do expect { subject.new(double('whatever')) }.to raise_error(ArgumentError, "don't know how to fabricate a subcommand for a 'RSpec::Mocks::Mock'") end end end end
Version data entries
15 entries across 15 versions & 1 rubygems