rspec_rails_4 icon indicating copy to clipboard operation
rspec_rails_4 copied to clipboard

ch.12 - "more concise" in details?

Open JunichiIto opened this issue 10 years ago • 0 comments

Technically speaking, we could also use the more concise expect(...).to be and expect(...).to_not be as well.

I am not sure what this sentence means. Do you mean you can change to be_falsey to to_not be_truethy , like this?

    describe "POST #create" do
      context "with valid attributes" do
        # ...

        it "creates a new contact" do
          expect(Contact.exists?(assigns[:contact])).to be_truthy
        end
      end

      context "with invalid attributes" do
        # ...

        it "does not save the new contact" do
          expect(Contact.exists?(contact)).to_not be_truthy
        end

        # ...
      end
    end

If so, I prefer to be_falsey because it is more readable for me.

JunichiIto avatar May 19 '14 06:05 JunichiIto