2018-03-04 10:09:32 -05:00
|
|
|
require_relative '../../spec_helper'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
|
|
|
describe "String#freeze" do
|
|
|
|
|
|
|
|
it "produces the same object whenever called on an instance of a literal in the source" do
|
2018-02-27 15:21:25 -05:00
|
|
|
"abc".freeze.should equal "abc".freeze
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "doesn't produce the same object for different instances of literals in the source" do
|
2018-02-27 15:21:25 -05:00
|
|
|
"abc".should_not equal "abc"
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "being a special form doesn't change the value of defined?" do
|
|
|
|
defined?("abc".freeze).should == "method"
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|