summaryrefslogtreecommitdiff
path: root/spec/ruby/core/set/pretty_print_cycle_spec.rb
blob: 7e6017c112b77e1ebe22c164267351bf4025f382 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require_relative '../../spec_helper'

describe "Set#pretty_print_cycle" do
  it "passes the 'pretty print' representation of a self-referencing Set to the pretty print writer" do
    pp = mock("PrettyPrint")
    ruby_version_is(""..."4.0") do
      pp.should_receive(:text).with("#<Set: {...}>")
    end
    ruby_version_is("4.0") do
      pp.should_receive(:text).with("Set[...]")
    end
    Set[1, 2, 3].pretty_print_cycle(pp)
  end
end