Rspec examples?

31 views
Skip to first unread message

Joran Kikke

unread,
Feb 26, 2013, 8:11:38 AM2/26/13
to espresso-...@googlegroups.com
Hello, 

I'm trying to set up Espresso with rspec coverage over my controllers, but can't find any examples or guidance on how to do this.

Any pointers would be great!

This works, but the index action has no params object or something
describe :items_controller do
  let :app do
    App
  end
  let :controller do
    Item.new
  end
  describe :index do
    context :with_valid_auth_token do
      it 'lists items' do
        response = controller.send(:index)
        response.should be_success
      end
    end
  end
end

Silviu Rusu

unread,
Feb 26, 2013, 8:58:07 AM2/26/13
to espresso-...@googlegroups.com, Joran Kikke

To test a Rack app you need a HTTP client like rack-test or Sonar.

Here is a basic example using RSpec and Sonar:


see it running here - http://cibox.org/slivu?lang=ruby&procedure_id=27 (working best in Chrome and Safari)

Will get some time soon to create a page about testing Espresso apps.


--
You received this message because you are subscribed to the Google Groups "Espresso Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to espresso-framew...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages