I am trying to write a custom formatter to update a database record based on example results. Having a lot of trouble, so I thought to ask if anyone has a custom formatter that writes results to a database or outputs results in JSON or some other programmatic format. A working example will go a long way in helping me work thru my own use case. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20111018/70834054/attachment.html>
On Oct 18, 2011, at 9:03 AM, Bill Christian wrote:> I am trying to write a custom formatter to update a database record based on example results. Having a lot of trouble, so I thought to ask if anyone has a custom formatter that writes results to a database or outputs results in JSON or some other programmatic format. A working example will go a long way in helping me work thru my own use case. > > Thanks > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-usersThere are RSpec''s own formatters: https://github.com/rspec/rspec-core/tree/master/lib/rspec/core/formatters And also Fuubar, an external one: https://github.com/jeffkreeftmeijer/fuubar
I''m about to start work on a JSON formatter. (I need it for a project where I''m executing RSpec on a server and shipping it down to a JS/HTML client for http://testfirst.org .) Any advice other than "look at lib/rspec/core/formatters/*.rb" before I start?>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120406/6f3d7d78/attachment.html>
I can add another example, that outputs HTML/JSON from a formatter. https://github.com/zipmark/rspec_api_documentation/blob/master/lib/rspec_api_documentation/api_formatter.rb This formatter works in concert with a DSL built on top of RSpec to output HTTP API documentation based on the test examples. The code for this formatter is split up between a number of classes. Of note are ApiFormatter, ApiDocumentation, Example, and Index. HTH, Sam On Fri, Apr 6, 2012 at 1:38 PM, Alex Chaffee <alexch at gmail.com> wrote:> I''m about to start work on a JSON formatter. (I need it for a project where > I''m executing RSpec on a server and shipping it down to a JS/HTML client for > http://testfirst.org .) Any advice other than "look at > lib/rspec/core/formatters/*.rb" before I start? > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users