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

Mocks breaks in crystal 0.16.0 #20

Closed
vjdhama opened this issue May 6, 2016 · 18 comments
Closed

Mocks breaks in crystal 0.16.0 #20

vjdhama opened this issue May 6, 2016 · 18 comments

Comments

@vjdhama
Copy link

vjdhama commented May 6, 2016

I was trying to run ambience specs against latest crystal release(0.16.0) locally, but it throws error.

$ crystal spec
Error in ./libs/mocks/mocks/registry.cr:140: can't use class variables in generic types

      @@_instances ||= reset!
      ^

I think it's because of these changes in crystal. I'll take stab at fixing it and raise A PR if I can.

Cheers.

@marceloboeira
Copy link
Contributor

@vjdhama thanks, that would be very helpful!

@vjdhama
Copy link
Author

vjdhama commented May 28, 2016

@waterlink I need help with this issue.

@waterlink
Copy link
Owner

@vjdhama Sure, let's fix that. Have you already advanced towards fixing? Can you share where you are code-wise now (like a link on github to a branch on your fork)?

vjdhama added a commit to vjdhama/mocks.cr that referenced this issue May 31, 2016
@vjdhama
Copy link
Author

vjdhama commented May 31, 2016

@waterlink Sorry for late reply. I have pushed changes to my fork.

@vjdhama
Copy link
Author

vjdhama commented May 31, 2016

I still don't have a way to get all instances of Method(T) inside module Instances class method.

@strzibny
Copy link

This would be great to resolve as I am also stuck with this.

@waterlink
Copy link
Owner

@strzibny @vjdhama @marceloboeira I have just made a release v0.9.2 and it should work with Crystal 0.18.4 now. Could you please try it out on your projects?

@marceloboeira
Copy link
Contributor

@waterlink I'll check out :D

@strzibny
Copy link

strzibny commented Jul 5, 2016

@waterlink it doesn't for me :(

$ crystal spec ./spec/**
Error in ./libs/mocks/mocks/registry.cr:140: can't use class variables in generic types

      @@_instances ||= reset!
      ^

$ crystal -v
Crystal 0.18.7 [68783f1] (2016-07-03)

$ cat shard.lock 
version: 1.0
shards:
  kemal:
    github: sdogruyol/kemal
    version: 0.13.0

  kilt:
    github: jeromegn/kilt
    version: 0.3.3

  mocks:
    github: waterlink/mocks.cr
    version: 0.9.2

  radix:
    github: luislavena/radix
    version: 0.3.0

  redis:
    github: stefanwille/crystal-redis
    version: 1.6.5

  singleton:
    github: waterlink/singleton.cr
    version: 0.1.0

Here is my project if you want to try it yourself: https://github.com/strzibny/hipparchus

@waterlink
Copy link
Owner

Code that is seen in the error message is no longer in the library. I am assuming that you still have an old version.

Can you show us your shard.lock?

shards update should help.

@strzibny
Copy link

strzibny commented Jul 6, 2016

@waterlink I showed the shard.lock in the comment, that's why I though I have correct version. But as you say the code was not updated. crystal deps update fixed this, so I confirm this works :). Thank you!

@justaskz
Copy link

justaskz commented Jul 7, 2016

I am getting this on Crystal 0.18.4 and latest shard versions.

Error in ./libs/spec2-mocks/spec2-mocks.cr:34: can't declare variable of generic non-instantiated type Mocks::HaveReceivedExpectation(T)

    @unwrap : ::Mocks::HaveReceivedExpectation

@waterlink
Copy link
Owner

Please create the issue at spec2-mocks project
Justas Kazakauskas notifications@github.com schrieb am Do., 7. Juli 2016
um 3:37 PM:

I am getting this on Crystal 0.18.4 and latest shard versions.

Error in ./libs/spec2-mocks/spec2-mocks.cr:34: can't declare variable of generic non-instantiated type Mocks::HaveReceivedExpectation(T)

@unwrap : ::Mocks::HaveReceivedExpectation


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAlLFs1IDA8Y8leWdXr8BJD0UG5ffo_Aks5qTQEWgaJpZM4IY1lz
.

@vjdhama
Copy link
Author

vjdhama commented Jul 25, 2016

@waterlink I still get an error, though that seems be due to spec2-mock.

Error in ./libs/spec2-mocks/spec2-mocks.cr:34: can't declare variable of generic non-instantiated type Mocks::HaveReceivedExpectation(T)

    @unwrap : ::Mocks::HaveReceivedExpectation
    ^~~~~~~

@vjdhama
Copy link
Author

vjdhama commented Jul 25, 2016

@waterlink Do we still have to use spec2-mock for spec2 shard to play well with mocks shard?

@waterlink
Copy link
Owner

Yes. spec2 should not know anything about mocks, as mocks should not know anything about spec2. spec2-mocks serves as a bridge between them and it knows about both of them, so that they can be changed independently (relatively).

@waterlink
Copy link
Owner

I have just released v0.4.0 of spec2-mocks and it should work with newest spec2 and mocks.

@vjdhama
Copy link
Author

vjdhama commented Jul 27, 2016

Kudos @waterlink. 👏

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

No branches or pull requests

5 participants