waterlink / spec2.cr

Enhanced `spec` testing library for [Crystal](http://crystal-lang.org/).
MIT License
103 stars 22 forks source link

Enabling shoulds crashes #58

Open vladfaust opened 7 years ago

vladfaust commented 7 years ago
instantiating 'Array(Redis::RedisValue)#should(Spec2::Matchers::Eq(Array(String)))'
in spec/spec_helper.cr:4: expanding macro

Spec2.enable_should_on_object
^

in macro 'enable_should_on_object' /home/faust/Projects/tele-broadcaster/lib/spec2/src/should.cr:2, line 3:

   1.     class Object
   2.       def should(matcher)
>  3.         ::Spec2::Context.expect(self).to matcher
   4.       end
   5. 
   6.       def should_not(matcher)
   7.         ::Spec2::Context.expect(self).not_to matcher
   8.       end
   9.     end
  10.   

undefined method 'expect' for Spec2::Context:Class

crystal 0.23.1

gummybears commented 6 years ago

Just started to use spec2, and also encountered this problem. I added the following to spec2/src/next/context.cr to get things going

def self.expect(actual)
  Expectation.new(actual)
end

Crystal 0.26.1 [391785249] (2018-08-27)