Sha256: 02bb8c51e8aab7ace931f42e6f3179f125411422367c1b442bc07da1213c1d75

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

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

describe 'block matcher' do    
  context "content without block" do
    not_class_self = %q{
        def hello
        end}    
    
    it "should not have block" do            
      not_class_self.should_not have_block :hello do |content|
        puts content
      end
    end
  end

  context "content with block: hello do" do  
    content = %q{
      hello do
        blip
      end # do}    

    it "should have block" do            
      content.should have_block :hello do |content|
        puts "content: #{content}"
      end
    end
  end
  
  context "content with block: hello :angel do" do  
    content = %q{
      hello :angel do
        blip
      end # do}    

    it "should have block" do            
      content.should have_block :hello, :args => ':angel' do |content|
        puts "content: #{content}"
      end
    end
  end

  context "content with block: hello :angel do |x,y|" do  
    content = %q{
      hello :angel do |x,y|
        blip
      end # do}    

    it "should have block" do            
      content.should have_block :hello, :args => ':angel', :block_args => 'x,y' do |content|
        puts "content: #{content}"
      end
    end
  end
end



Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
generator-spec-0.5.0 spec/generator_spec/matchers/content/have_block_spec.rb
generator-spec-0.4.8 spec/generator_spec/matchers/content/have_block_spec.rb