Changeset 575
- Timestamp:
- 07/01/08 10:59:41 (3 months ago)
- Files:
-
- linen/trunk/spec/command_infrastructure_spec.rb (modified) (1 diff)
- linen/trunk/spec/shared_behaviours.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
linen/trunk/spec/command_infrastructure_spec.rb
r573 r575 24 24 describe Linen::Plugin::CommandInfrastructure do 25 25 before( :each ) do 26 @command_class = Class.new { include Linen::Plugin::CommandInfrastructure } 26 @plugin = mock( "mock plugin" ) 27 @plugin.stub!( :short_name ).and_return( "infrastructure_plugin" ) 28 @command_class = Linen::Plugin::SimpleCommand 29 @command = @command_class.new( @plugin, "command_infrastructure" ) {} 27 30 end 28 31 linen/trunk/spec/shared_behaviours.rb
r574 r575 23 23 24 24 describe "a class that includes Linen::Plugin::CommandInfrastructure", :shared => true do 25 before( :each ) do26 @plugin = mock( "mock plugin" )27 @plugin.stub!( :short_name ).and_return( "plugin" )28 29 @command = @command_class.new( @plugin, "command" ) {}30 end31 32 25 describe "conforms to the Command definition API" do 33 26 it "implements the require_confirmation directive" do … … 47 40 it "implements the help_message directive" do 48 41 message = "This command is used for BEES" 49 50 @command.instance_variable_get( :@help_text ).should == "No help for plugin command" 42 expected = "No help for #{@plugin.short_name} #{@command.name}" 43 44 @command.instance_variable_get( :@help_text ).should == expected 51 45 @command.instance_eval { help_message message } 52 46 @command.instance_variable_get( :@help_text ).should be( message ) … … 100 94 101 95 help_lines = @command.help.split( "\n" ) 102 help_lines.shift.should == "No help for plugin command"96 help_lines.shift.should == "No help for #{@plugin.short_name} #{@command.name}" 103 97 help_lines.shift.should == "" 104 help_lines.shift.should == "Usage: plugin command<a> <b> <c>"98 help_lines.shift.should == "Usage: #{@plugin.short_name} #{@command.name} <a> <b> <c>" 105 99 end 106 100 … … 113 107 help_lines.shift.should == help_msg 114 108 help_lines.shift.should == "" 115 help_lines.shift.should == "Usage: plugin sandwich<shoot> <reload> <eat>"109 help_lines.shift.should == "Usage: #{@plugin.short_name} #{@command.name} <shoot> <reload> <eat>" 116 110 end 117 111 end
