rspec_rails_4
rspec_rails_4 copied to clipboard
ch.12 - "more concise" in details?
Technically speaking, we could also use the more concise
expect(...).to be
andexpect(...).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.