Sha256: 5ff93afebc2e0c78a17f3b9a60d8bcec1f1ef23542e49f78f9dab47f507fbe80

Contents?: true

Size: 1.63 KB

Versions: 7

Compression:

Stored size: 1.63 KB

Contents

require File.expand_path("../spec_helper", File.dirname(__FILE__))

describe Sprinkle::Script, 'class' do
  
  it 'should define a entry point into the system' do
    Sprinkle::Script.should respond_to(:sprinkle)
  end
  
  it 'should respond to deployment' do
    Sprinkle::Script.new.should respond_to(:deployment)
  end
  
end

describe Sprinkle::Script, 'when given a script' do
  
  before do
    @script = 'script'
    @filename = 'filename'
    
    @sprinkle = Sprinkle::Script.new
    Sprinkle::Script.stub!(:new).and_return(@sprinkle)
  end

  it 'should create a new sprinkle instance' do
    Sprinkle::Script.should_receive(:new).and_return(@sprinkle)
    Sprinkle::Script.sprinkle @script
  end
  
  it 'should evaulate the sprinkle script against the instance' do
    @sprinkle.should_receive(:instance_eval).and_return
    Sprinkle::Script.sprinkle @script
  end
  
  it 'should specify the filename if given for line number errors' do 
    @sprinkle.should_receive(:instance_eval).with(@script, @filename).and_return
    Sprinkle::Script.sprinkle @script, @filename
  end
  
  it 'should specify a filename of __SCRIPT__ by default if none is provided' do 
    @sprinkle.should_receive(:instance_eval).with(@script, '__SCRIPT__').and_return
    Sprinkle::Script.sprinkle @script
  end
  
  it 'should automatically run in production mode by default' do
    @sprinkle.should_receive(:instance_eval).with(@script, '__SCRIPT__').and_return
    Sprinkle::Script.sprinkle @script
  end
  
  it 'should ask the Sprinkle instance to process the data from the script' do
    @sprinkle.should_receive(:sprinkle)
    Sprinkle::Script.sprinkle @script
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sprinkle-0.7.4 spec/sprinkle/script_spec.rb
sprinkle-0.7.3 spec/sprinkle/script_spec.rb
sprinkle-0.7.2 spec/sprinkle/script_spec.rb
sprinkle-0.7.1.1 spec/sprinkle/script_spec.rb
sprinkle-0.7.1 spec/sprinkle/script_spec.rb
sprinkle-0.7 spec/sprinkle/script_spec.rb
sprinkle-0.6.2 spec/sprinkle/script_spec.rb