Setup local variable for attribute name; simpler check for Rails version

See also:

* https://github.com/rspec/rspec-rails/pull/937#commitcomment-6170626
* https://github.com/rspec/rspec-rails/pull/937#commitcomment-6170693