Validate or fix code that doesn’t adhere to EditorConfig settings

ECLint is a tool for validating or fixing code that doesn’t adhere to settings defined in .editorconfig. It also infers settings from existing code. See the EditorConfig Project for details about the .editorconfig file.

via jedmao/eclint: Validate or fix code that doesn’t adhere to EditorConfig settings or infer settings from existing code.

Advertisements

Equality matchers in RSpec Expectations

Ruby exposes several different methods for handling equality:

a.equal?(b) # object identity - a and b refer to the same object
a.eql?(b)   # object equivalence - a and b have the same value
a == b      # object equivalence - a and b have the same value with type conversions

rspec-expectations ships with matchers that align with each of these methods:

expect(a).to equal(b) # passes if a.equal?(b)
expect(a).to eql(b) # passes if a.eql?(b)
expect(a).to be == b # passes if a == b

It also ships with two matchers that have more of a DSL feel to them:

expect(a).to be(b) # passes if a.equal?(b)
expect(a).to eq(b) # passes if a == b

via Equality matchers – Built in matchers – RSpec Expectations – RSpec – Relish