Sha256: fb507c9f557ecbc2582831b7d774adb00db0cdfe0284a4979d81736af2f2d93b

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

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

describe 'method matcher' do    
  context "content without method" do
    no_method = %q{
        class X
        end}    
    
    it "should not have method hello" do            
      no_method.should_not have_method :hello do |content|
        puts content
      end
    end
  end
  
  context "content with method hello" do  
    with_method = %q{
        def hello
        end}    
    it "should have method hello" do            
      with_method.should have_method :hello do |content|
        puts "content: #{content}"
      end
    end
  end

  context "content: method hello with args (x, y)" do  
    with_method = %q{
        def hello(x, y)
        end}    
    it "should have method hello" do            
      with_method.should have_method :hello, :args => 'x, y' do |content|
        puts "content: #{content}"
      end
    end
  end

  context "content: method hello with args x, y" do  
    with_method = %q{
        def hello x, y
        end}    
    it "should have method hello with args x, y" do            
      with_method.should have_method :hello, :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_method_spec.rb
generator-spec-0.4.8 spec/generator_spec/matchers/content/have_method_spec.rb