Sha256: f5fa3fee1b33cc467677a2f4e7801fa7a4eaf78a85df21d953e04ff4b8fb7fd1

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe 'classes matcher' do    
  context "no class" do
    no_class = %q{
        module X
          hello
          hi
        end
    }    
    
    it "should not have class X" do            
      no_class.should_not have_subclasses :x
    end
  end

  context "content with class X" do  
    class_x = %q{
      class X
        def hello
          blip
        end
      end
    }    
    it "should not have subclass X of Y" do
      class_x.should_not have_subclasses :x, :superclass => :y
    end
  end

  context "content with subclass X of Y" do  
    class_x = %q{
      class X < Y
        def hello
          blip
        end
      end
    }    
    it "should have subclass X of Y" do
      class_x.should have_subclasses :x, :superclass => :y
      class_x.should_not have_subclasses :y, :superclass => :x
    end
  end
  
  context "content with subclasses X and Y of Z" do  
    classs_x_y = %q{
      class X < Z
        def hello
          blip
        end
      end

      class Y < Z
        def hello
          blip
        end
      end
    }    
    it "should have classs X and Y of Z" do            
      classs_x_y.should have_subclasses :x, :y, :superclass => :z
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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