Sha256: 45a5f02cbb292ed52eb84f24efd677dd9e79a02a7857c174ea626cbcf6e7757a

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

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

describe 'method calls matcher' do    
  context "content without calls" do
    not_class_self = %q{
        def x
        end
  
        def y
        end        
        }    
    
    it "should not have calls to x or y" do            
      not_class_self.should_not have_calls :x, :y do |content|
        puts content
      end
    end
  end
  
  context "content with calls to x and y" do  
    class_self = %q{
        def x
          x
          y
        end}    

    it "should have calls to x and y" do            
      class_self.should have_calls :x, :y do |content|
        puts "content: #{content}"
      end
    end
  end

  context "content with calls to x and y" do  
    class_self = %q{
        def x
          x(2)
          y 3
        end}    
  
    it "should have calls: x(2) and y 3" do            
      class_self.should have_calls :x => '2', :y => '3' 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_calls_spec.rb
generator-spec-0.4.8 spec/generator_spec/matchers/content/have_calls_spec.rb