rspec-expectations One-liner not working out of the box!

40 views
Skip to first unread message

netzfisch

unread,
Dec 6, 2012, 5:18:01 PM12/6/12
to rs...@googlegroups.com
The the rspec-expectations documentation (http://rubydoc.info/gems/rspec-expectations/frames #4.2) says:

The one-liner syntax supported by rspec-core uses should even when config.syntax = :expect. It reads better than the alternative, and does not require a global monkey patch:

describe User do
   it { should validate_presence_of :email }
end 

The expect-syntax works, but the One-Liner-Syntax does NOT work out of the box. Do I have to activate the "shoulda gem" form thougtbot?

Myron Marston

unread,
Dec 13, 2012, 10:42:37 AM12/13/12
to rspec
The syntax itself (e.g. `it { should <matcher> }`) works just fine.
The `validate_presence_of` matcher is from shoulda, though.

On Dec 6, 2:18 pm, netzfisch <tj2...@gmail.com> wrote:
> The the rspec-expectations documentation
> (http://rubydoc.info/gems/rspec-expectations/frames#4.2) says:
>
> The one-liner syntax supported by rspec-core<http://rubydoc.info/gems/rspec-core>
Reply all
Reply to author
Forward
0 new messages