Sha256: ab540a4a9609e51299a9e5f528defd894587bef5d984c6bd9f2a36f5968dfb26

Contents?: true

Size: 978 Bytes

Versions: 9

Compression:

Stored size: 978 Bytes

Contents

require 'spec_helper'

describe 'method matcher' do    
  context "content without method" do
    no_method = %q{
        class X
          hello
          hi
        end}    
    
    it "should not have method hello" do            
      no_method.should_not have_methods :hello, :hi do |content|
        content.should_not be_empty
      end
    end
  end

  context "content with method hello" do  
    with_method = %q{
        def hello
          blip
        end
    }    
    it "should have method hello" do            
      with_method.should have_methods :hello
      with_method.should_not have_methods :hi
      with_method.should_not have_methods :hello, :hi
    end
  end
  
  context "content with method hello" do  
    with_method = %q{
        def hello
          blip
        end

        def hi
          blip
        end        
    }    
    it "should have method hello" do            
      with_method.should have_methods :hello, :hi
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
code-spec-0.4.0 spec/code-spec/matchers/multi/have_methods_spec.rb
code-spec-0.3.0 spec/code-spec/matchers/multi/have_methods_spec.rb
code-spec-0.2.11 spec/code-spec/matchers/multi/have_methods_spec.rb
code-spec-0.2.9 spec/code-spec/matchers/multi/have_methods_spec.rb
code-spec-0.2.8 spec/code-spec/matchers/multi/have_methods_spec.rb
code-spec-0.2.7 spec/code-spec/matchers/multi/have_methods_spec.rb
code-spec-0.2.6 spec/code-spec/matchers/multi/have_methods_spec.rb
code-spec-0.2.5 spec/code-spec/matchers/multi/have_methods_spec.rb
code-spec-0.2.4 spec/code-spec/matchers/multi/have_methods_spec.rb