There are 2 syntaxes (afaik) for writing tests with RSpec:
The classic/old way:
describe "when user_id is not present" do
before { @micropost.user_id = nil }
it "should not be valid" do
@micropost.should_not be_valid
end
end
That gives this error when failing:
rspec ./spec/models/micropost_spec.rb:19 # Micropost when user_id is not present should not be valid
And the short syntax:
describe "when user_id is not present" do
before { @micropost.user_id = nil }
it { should_not be_valid }
end
That gives this error when failing:
rspec ./spec/models/micropost_spec.rb:18 # Micropost when user_id is not present
The last one is missing the "should not be valid" part.
Is there any way to have the complete test failure message, maybe a flag I don't know about?
Note: A more complete error message is still there no matter what:
1) Micropost when user_id is not present
Failure/Error: it { should_not be_valid }
expected #<Micropost id: nil, content: "Lorem ipsum", user_id: nil, created_at: nil, updated_at: nil> not to be valid
# ./spec/models/micropost_spec.rb:18:in `block (3 levels) in <top (required)>'
But the recap at the end is incomplete.