Sha256: 7ee61385ffa68082073f8d96e64986445b714e079faa722444eb8b2e2407ce76

Contents?: true

Size: 1.63 KB

Versions: 5

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

5 entries across 5 versions & 1 rubygems

Version Path
sprinkle-0.7.7 spec/sprinkle/script_spec.rb
sprinkle-0.7.6.2 spec/sprinkle/script_spec.rb
sprinkle-0.7.6.1 spec/sprinkle/script_spec.rb
sprinkle-0.7.6 spec/sprinkle/script_spec.rb
sprinkle-0.7.5 spec/sprinkle/script_spec.rb