Sha256: 07309b69e86d2043ca7945fbee6c605f3ba4452d676549b8b90215eb943b0ac5
Contents?: true
Size: 1.08 KB
Versions: 10
Compression:
Stored size: 1.08 KB
Contents
require 'spec_helper' describe Rails::Sh do context 'when define a command' do before do @block = lambda {} Rails::Sh::Command.define('foo', &@block) end ['foo'].each do |line| it "the command should be executed if the line is '#{line}'" do @block.should_receive(:call).with(nil).once Rails::Sh.should_receive(:execute_rails_command).with(line).exactly(0).times Rails::Sh.execute(line) end end ['fo', 'bar'].each do |line| it "the command should not be executed if the line is '#{line}'" do @block.should_receive(:call).with(nil).exactly(0).times Rails::Sh.should_receive(:execute_rails_command).with(line).once Rails::Sh.execute(line) end end end ['console', 'g --help'].each do |line| before do Rails::Sh.stub(:clear_dependencies) end it "a rails's command should be executed if the line is #{line}" do Rails::Sh.should_receive(:load).with("rails/commands.rb") do ARGV.should eq(line.split(/\s+/)) end Rails::Sh.execute(line) end end end
Version data entries
10 entries across 10 versions & 1 rubygems