Extract common query to a constant.

Perf ref: https://gist.github.com/vipulnsward/8209749201dfdd678c97
Merge pull request #11329 from vipulnsward/cache_one

Extract common query to a constant.
Remove action view test duplication

Same test exists above 2 or 3 lines.
Merge pull request #11332 from sanemat/fix/av-test-duplication

Remove actionview test duplication