Sha256: 8100b20149abc58cc460b60be7d227ea4dace38388941644d13186863b37cf54

Contents?: true

Size: 1.51 KB

Versions: 63

Compression:

Stored size: 1.51 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Sprinkle::Script, 'class' do
  
  it 'should define a entry point into the system' do
    Sprinkle::Script.should respond_to(:sprinkle)
  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

63 entries across 63 versions & 13 rubygems

Version Path
sprinkle-0.2.2 spec/sprinkle/script_spec.rb
sprinkle-0.2.1 spec/sprinkle/script_spec.rb
sprinkle-0.1.9 spec/sprinkle/script_spec.rb