Sha256: b37af2e49eecdc835423018147b729b22dadb8ec01597b46a4a1da97d9f339df

Contents?: true

Size: 1.3 KB

Versions: 21

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

RSpec.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 "returns ID" do
      expect(message("Hello World!").id).to eq "Hello World!"
    end
  end

  describe "#add_location" do
    it "adds some locations" do
      @message.add_location("hello.rb", 10)
      @message.add_location("message.rb", 5)
      expect(@message.locations).to eq Set.new([["hello.rb", 10], ["message.rb", 5]])
    end
  end

  describe "#add_comment" do
    it "adds some comments" do
      @message.add_comment("YARD.title")
      @message.add_comment("Hello#message")
      expect(@message.comments).to eq Set.new(["YARD.title", "Hello#message"])
    end
  end

  describe "#==" do
    it "returns 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

      expect(@message).to eq other_message
    end
  end
end

Version data entries

21 entries across 20 versions & 4 rubygems

Version Path
yard-0.9.24 spec/i18n/message_spec.rb
yard-0.9.23 spec/i18n/message_spec.rb
yard-0.9.22 spec/i18n/message_spec.rb
yard-0.9.21 spec/i18n/message_spec.rb
yard-0.9.20 spec/i18n/message_spec.rb
yard-0.9.19 spec/i18n/message_spec.rb
yard-0.9.16 spec/i18n/message_spec.rb
yard-0.9.15 spec/i18n/message_spec.rb
yard-0.9.14 spec/i18n/message_spec.rb
yard-0.9.13 spec/i18n/message_spec.rb
yard-0.9.12 spec/i18n/message_spec.rb
yard-0.9.11 spec/i18n/message_spec.rb
yard-0.9.10 spec/i18n/message_spec.rb
yard-0.9.9 spec/i18n/message_spec.rb
etude_for_ruby-0.1.4 vendor/bundle/ruby/2.4.0/gems/yard-0.9.8/spec/i18n/message_spec.rb
etude_for_ruby-0.1.4 vendor/bundle/ruby/2.2.0/gems/yard-0.9.8/spec/i18n/message_spec.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/yard-0.9.8/spec/i18n/message_spec.rb
yard-0.9.8 spec/i18n/message_spec.rb
abaci-0.3.0 vendor/bundle/gems/yard-0.9.7/spec/i18n/message_spec.rb
yard-0.9.7 spec/i18n/message_spec.rb