Sha256: 3f385380d5066c45ec84548adc7dea8fd70e8f436796d35603f1d512f3f9255e

Contents?: true

Size: 1.25 KB

Versions: 16

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe 'method matcher' do    
  context "content without method" do
    no_method = %q{
        class X
          hello
        end}    
    
    it "should not have method hello" do            
      no_method.should_not have_method :hello 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_method :hello do |content|
        content.should_not be_empty
      end
    end
  end

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

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

end



Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
code-spec-0.4.0 spec/code-spec/matchers/have_method_spec.rb
code-spec-0.3.0 spec/code-spec/matchers/have_method_spec.rb
code-spec-0.2.11 spec/code-spec/matchers/have_method_spec.rb
code-spec-0.2.9 spec/code-spec/matchers/have_method_spec.rb
code-spec-0.2.8 spec/code-spec/matchers/have_method_spec.rb
code-spec-0.2.7 spec/code-spec/matchers/have_method_spec.rb
code-spec-0.2.6 spec/code-spec/matchers/have_method_spec.rb
code-spec-0.2.5 spec/code-spec/matchers/have_method_spec.rb
code-spec-0.2.4 spec/code-spec/matchers/have_method_spec.rb
code-spec-0.2.3 spec/code-spec/matchers/have_method_spec.rb
code-spec-0.2.2 spec/code-spec/matchers/have_method_spec.rb
code-spec-0.2.1 spec/code-spec/matchers/have_method_spec.rb
code-spec-0.2.0 spec/code-spec/matchers/have_method_spec.rb
code-spec-0.1.3 spec/code-spec/matchers/have_method_spec.rb
code-spec-0.1.2 spec/code-spec/matchers/have_method_spec.rb
code-spec-0.1.0 spec/code-spec/matchers/have_method_spec.rb