Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify be_identical_string/be_diffed_as in spec/string_matcher.rb #176

Merged
merged 1 commit into from
Feb 9, 2015

Conversation

bf4
Copy link
Contributor

@bf4 bf4 commented Feb 9, 2015

Changed meaning of be_identical_string not to include an encoding comparison.
Encoding comparison is now only turned on by chaining
'with_same_encoding'.

This leaves open the possibility of chaining 'with_encoding(enc)', but there's
currently not need for that.

# check for string encoding.
def expected_encoding?
if defined?(@expect_same_encoding) && @expect_same_encoding
actual.encoding == expected.encoding
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this blow up on 1.8.7?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really not sure how to get the best semantics from the matchers and also the least hacky implementation of the matcher. I'm not married to this implementation, but I liked the semantics of be_identical_string(str).with_same_encoding better than adding a new be_identical_encoded_string that is called from be_identical_string.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just missed the encoding check above

Changed meaning of be_identical_string not to include an encoding
comparison.  Encoding comparison is now only turned on by chaining
'with_same_encoding'.

This leaves open the possibility of chaining 'with_encoding(enc)',
but there's currently not need for that.
@bf4 bf4 force-pushed the factor_out_string_matcher branch from 8b9d490 to 92c3e0e Compare February 9, 2015 04:45
@bf4
Copy link
Contributor Author

bf4 commented Feb 9, 2015

forgot to require "rspec/matchers" at the top of the file. amended and force pushed.

@myronmarston
Copy link
Member

LGTM

JonRowe added a commit that referenced this pull request Feb 9, 2015
Unify be_identical_string/be_diffed_as in spec/string_matcher.rb
@JonRowe JonRowe merged commit 0b23e89 into rspec:master Feb 9, 2015
@JonRowe
Copy link
Member

JonRowe commented Feb 9, 2015

Thanks @bf4 :)

@bf4
Copy link
Contributor Author

bf4 commented Feb 9, 2015

Wow, that was quite a weekend. Thanks @JonRowe @myronmarston

@bf4 bf4 deleted the factor_out_string_matcher branch February 9, 2015 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants