Comments (7)
This can be worked around (and might be preferred) to use the match_array
matcher instead.
This should work, since it's valid Crystal syntax, so I'll look at providing a fix.
from spectator.
In my example findings
can contain exactly the expected_metdata
Array of Tuples when it's ran on my machine. When I run the specs on a Ubuntu system with Ubuntu's version of libextractor, then additional Tuples show up in findings
. So I need something like RSpec's .to include(*array)
.
from spectator.
Would a non-splat version of contain
work? That looks faster/easier to implement than fixing splatting within contain
for now. Perhaps something like contain_elements(array_or_tuple)
?
from spectator.
Could we overload contain
to accept an Array(Tuple)
?
from spectator.
There should be a fix in the latest version (0.9.22). Can you see if that works for you? This snippet worked for me:
Spectator.describe "GitHub Issue 8" do
it "works without a splat" do
expect([1, 2, 3, 4, 5]).to contain(2, 3, 4)
end
it "works with a splat" do
elements = {2, 3, 4}
expect([1, 2, 3, 4, 5]).to contain(*elements)
end
end
from spectator.
Excellent. It compiles now. Still failing due to another weird equality issue that I'm still investigating; the same code works if I write it as plain crystal code and compare the two Array(Tuple)
objects with ==
.
from spectator.
Excellent. It compiles now. Still failing due to another weird equality issue that I'm still investigating; the same code works if I write it as plain crystal code and compare the two
Array(Tuple)
objects with==
.
Please let me know if you find an issue with this. That sounds like it could be a big issue.
The contain
matcher uses this for its check:
expected.value.all? do |item|
actual.includes?(item)
end
The includes?
method uses the ==
operator, should everything should be okay...
https://github.com/crystal-lang/crystal/blob/5999ae29b/src/enumerable.cr#L616
from spectator.
Related Issues (20)
- stub method(arg1,arg2,...) syntax seems to no longer work in 0.10/master HOT 3
- How to spec classes that contain class which shadow top-level primitives? HOT 4
- How to mock/stub IO::Memory#gets HOT 8
- Noticed line/column skew during incremental porting of RSpec files over to Spectator HOT 1
- Add RSpec's stub_const
- Better error when attempting to use string interpolation in it descriptions? HOT 11
- Problem with mock when using abstract class HOT 7
- Stubbed methods with default arguments not working HOT 3
- Mock not working for Process.run with block. HOT 10
- Runner filter -e tests equality instead of inclusion
- Example of custom matcher does not compile HOT 1
- Usage of keyword arguments as positional arguments in stubs HOT 1
- Mocks fail to compile for methods with free variables HOT 8
- Attempting to mock File results in error HOT 4
- Allow mocking libs
- Mocks on nameless splats HOT 2
- Re-run only failures HOT 1
- Segfault with nilable substring method call HOT 2
- `be_within` not respected during a `to have_received.with` check HOT 9
- subject with structs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spectator.