Refactoring

Integrate rubocop and do some refactoring. All functionals tests passed.
Using `be_truthy` could be confusing sometimes. Prefer `expect(something).to eq true`