Sha256: 75edb6489186e2177dab47bbc121f1ce485e0f696fd84590c7b14ff81a1f3112

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

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

describe YARD::I18n::Message do
  def message(id)
    YARD::I18n::Message.new(id)
  end

  before do
    @message = message("Hello World!")
  end

  describe "#id" do
    it "should return ID" do
      message("Hello World!").id.should == "Hello World!"
    end
  end

  describe "#add_location" do
    it "should add some locations" do
      @message.add_location("hello.rb", 10)
      @message.add_location("message.rb", 5)
      @message.locations.should == Set.new([["hello.rb", 10], ["message.rb", 5]])
    end
  end

  describe "#add_comment" do
    it "should add some comments" do
      @message.add_comment("YARD.title")
      @message.add_comment("Hello#message")
      @message.comments.should == Set.new(["YARD.title", "Hello#message"])
    end
  end

  describe "#==" do
    it "should return true for same value messages" do
      locations = [["hello.rb", 10], ["message.rb", 5]]
      comments = ["YARD.title", "Hello#message"]

      other_message = message(@message.id)
      locations.each do |path, line|
        @message.add_location(path, line)
        other_message.add_location(path, line)
      end
      comments.each do |comment|
        @message.add_comment(comment)
        other_message.add_comment(comment)
      end

      @message.should == other_message
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
deg-yard-0.8.7.4 spec/i18n/message_spec.rb
deg-yard-0.8.7.3 spec/i18n/message_spec.rb
deg-yard-0.8.7.1 spec/i18n/message_spec.rb