Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Remove Set #1870

Merged
merged 3 commits into from
Feb 20, 2015
Merged

Remove Set #1870

merged 3 commits into from
Feb 20, 2015

Conversation

JonRowe
Copy link
Member

@JonRowe JonRowe commented Feb 8, 2015

In general we want to require as little of the std lib as possible to prevent false positives with peoples code due to us using part of the std lib and then developers not requiring those parts, this removes our existing usage of set which is normally done for uniqueness / constant time lookup reasons and replaces it with a class that uses a hash internally.

end
end
end
end
Copy link
Member

Choose a reason for hiding this comment

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

This seems like an odd place for it given it's not really "core" to RSpec. It's very much a supporting class and not something that should be front-and-center in the main required file of RSpec. Can you move this into another file?

@myronmarston
Copy link
Member

Looking good. It concerns me a little that LookupSet isn't directly tested. WDYT about adding specs for it? It is pretty simple but it would provide confidence it mirrors Set behavior if you defined a shared example group for the methods that both support and applied it to both to show they have the same behaviors.

@JonRowe
Copy link
Member Author

JonRowe commented Feb 9, 2015

Yeah this was a proof of concept really, I think it needs it's own file and specs.

@JonRowe
Copy link
Member Author

JonRowe commented Feb 9, 2015

I'll try to do that sometime tomorrow

@JonRowe JonRowe force-pushed the remove_set branch 3 times, most recently from 564180c to 854f5a3 Compare February 18, 2015 02:47
@JonRowe
Copy link
Member Author

JonRowe commented Feb 18, 2015

Think this is ready for a review...


def <<(key)
@values[key] = true
end
Copy link
Member

Choose a reason for hiding this comment

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

With a normal set (and every other built-in that defines a << method that I can think of), this method returns the set itself:

irb(main):002:0> s = Set.new
=> #<Set: {}>
irb(main):003:0> s << 1
=> #<Set: {1}>

Yours returns true, I believe. I think you should add self on the next line to mirror the normal behavior.

@myronmarston
Copy link
Member

can you remove this as well?

/set\.rb/, # used in a few places but being removed in #1870.

@JonRowe JonRowe force-pushed the remove_set branch 2 times, most recently from d32bb27 to 0cbb17f Compare February 18, 2015 22:40
@JonRowe
Copy link
Member Author

JonRowe commented Feb 19, 2015

Removed and renamed...

@@ -2,6 +2,8 @@
$_rspec_core_load_started_at = Time.now
# rubocop:enable Style/GlobalVars

require 'rbconfig'
Copy link
Member

Choose a reason for hiding this comment

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

Why did you add back this require?

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't intentionally... rebase...

@myronmarston
Copy link
Member

LGTM, merge when green.

@JonRowe
Copy link
Member Author

JonRowe commented Feb 20, 2015

Merging despite Appveyor failure because it's a gem fetch error and the other appveyor job passed

JonRowe added a commit that referenced this pull request Feb 20, 2015
@JonRowe JonRowe merged commit 6aedf15 into master Feb 20, 2015
@JonRowe JonRowe deleted the remove_set branch February 20, 2015 00:36
JonRowe added a commit that referenced this pull request Feb 20, 2015
MatheusRich pushed a commit to MatheusRich/rspec-core that referenced this pull request Oct 30, 2020
MatheusRich pushed a commit to MatheusRich/rspec-core that referenced this pull request Oct 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants