Hi all, long time-user here, but first time poster... I've been a fan of 
rspec for about 6 years now.

Anyway, I'm writing because I'm making some specs and trying to use the 
one-liner syntax to keep it brief.  It works, except for when I try to use 
it with the change matcher.  It's a simple controller spec I'm doing:

    describe "GET #index" do
      subject { get :index }

      it { should be_success }

      # attempt 1
      it { is_expected.to change{assigns(:assets)}.from(nil) }

      # attempt 2
      it { should change{assigns(:assets)}.from(nil) }

      # attempt 3
      it "should assign @asset" do
        expect{subject}.to change {assigns(:assets)}.from(nil)
      end
    end

Both attempt 1 and 2 above fail with the message "expected result to have 
changed from nil, but was not given a block".  Attempt 3 succeeds.

Can anyone explain what's going on here?

Thanks so much!

Greg



-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/3549afe2-70b2-4cd2-8fd1-6f31ad42b13f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to