Refactoring slow running specs

* Replacing slower running functional tests with faster unit tests.
* Removing unnecessary spec
* Replacing == with is_a?

[skip log]