Sha256: 650d3d62ef4c8856e83c074d587cb3f071247b29f55b9fd3e6095f676ab2438a

Contents?: true

Size: 1.81 KB

Versions: 3

Compression:

Stored size: 1.81 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../../example_helper")

describe Micronaut::Example, :parent_metadata => 'sample' do

  before do
    behaviour = stub('behaviour', :metadata => { :behaviour => { :name => 'behaviour_name' }})
    @example = Micronaut::Example.new(behaviour, 'description', {}, (lambda {}))
  end
  
  describe "attr readers" do
  
    it "should have one for the parent behaviour" do
      @example.should respond_to(:behaviour)
    end
  
    it "should have one for it's description" do
      @example.should respond_to(:description)
    end
  
    it "should have one for it's metadata" do
      @example.should respond_to(:metadata)
    end
  
    it "should have one for it's block" do
      @example.should respond_to(:example_block)
    end

  end
  
  describe '#inspect' do
    
    it "should return 'behaviour_name - description'" do
      @example.inspect.should == 'behaviour_name - description'
    end
    
  end
  
  describe '#to_s' do
    
    it "should return #inspect" do
      @example.to_s.should == @example.inspect
    end
    
  end
  
  describe "accessing metadata within a running example" do

    it "should have a reference to itself when running" do
      running_example.description.should == "should have a reference to itself when running"
    end

    it "should be able to access the behaviours top level metadata as if it were its own" do
      running_example.metadata.each { |k,v| puts "#{k} => #{v.inspect}\n\n" }
      running_example.behaviour.metadata.should include(:parent_metadata => 'sample')
      running_example.metadata.should include(:parent_metadata => 'sample')
    end
  
  end
  
  describe "#run" do
    
    pending "should run after(:each) when the example fails"

    pending "should run after(:each) when the example raises an Exception" 
    
  end
  
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spicycode-micronaut-0.2.1.4 examples/lib/micronaut/example_example.rb
spicycode-micronaut-0.2.1.5 examples/lib/micronaut/example_example.rb
spicycode-micronaut-0.2.1.6 examples/lib/micronaut/example_example.rb