Sha256: 85a9238d28dbd1fae36d805084d12a365a22adb1d34fe95624962665560eb7b1

Contents?: true

Size: 787 Bytes

Versions: 11

Compression:

Stored size: 787 Bytes

Contents

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

describe Roodi::Checks::CoreMethodOverrideCheck do
  before(:each) do
    @roodi = Roodi::Core::Runner.new(Roodi::Checks::CoreMethodOverrideCheck.new)
  end

  it "should accept a class with a method" do
    content = <<-END
    class WellBehavedClass
      def well_behaved_method
      end
    end
    END
    @roodi.check_content(content)
    @roodi.errors.should be_empty
  end

  it "should reject a class which overrides the class method" do
    content = <<-END
    class BadClass
      def class
      end
    end
    END
    @roodi.check_content(content)
    errors = @roodi.errors
    errors.should_not be_empty
    errors[0].to_s.should eql("dummy-file.rb:2 - Class overrides method 'class'.")
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
roodi-5.0.0 spec/roodi/checks/core_method_override_check_spec.rb
roodi-4.1.1 spec/roodi/checks/core_method_override_check_spec.rb
roodi-4.1.0 spec/roodi/checks/core_method_override_check_spec.rb
roodi-4.0.0 spec/roodi/checks/core_method_override_check_spec.rb
roodi-3.3.1 spec/roodi/checks/core_method_override_check_spec.rb
roodi-3.3.0 spec/roodi/checks/core_method_override_check_spec.rb
roodi-3.2.0 spec/roodi/checks/core_method_override_check_spec.rb
roodi-3.1.1 spec/roodi/checks/core_method_override_check_spec.rb
roodi-3.1.0 spec/roodi/checks/core_method_override_check_spec.rb
roodi-3.0.1 spec/roodi/checks/core_method_override_check_spec.rb
roodi-3.0.0 spec/roodi/checks/core_method_override_check_spec.rb