Unit tests for case when the processing returned with ERROR state

@diegoamc when we reviewed https://github.com/mezuro/prezento/pull/105 we forgot bout the unit tests :/

This pull request adds the coverage.
A test helper to make possible ajax request to the controller.

http://apidock.com/rails/ActionController/TestCase/Behavior/xhr

2014-09-13 22:24 GMT-03:00 Diego de Araújo Martinez Camarinha <
notifications@github.com>:

> In spec/controllers/repositories_controller_spec.rb:
>
> > @@ -310,6 +310,20 @@
> >        it { is_expected.to respond_with(:ok) }
> >        it { is_expected.not_to render_with_layout }
> >      end
> > +
> > +    context 'with a ERROR state' do
> > +      let(:errored_processing) { FactoryGirl.build(:errored_processing) }
> > +
> > +      before :each do
> > +        repository.expects(:last_processing).returns(errored_processing)
> > +        Repository.expects(:find).at_least_once.with(repository.id).returns(repository)
> > +
> > +        xhr :get, :state, {project_id: project.id.to_s, id: repository.id, last_state: 'ANALYZING'}
>
> What's xhr?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/mezuro/prezento/pull/118/files#r17515853>.
>