Hello is it possible to make something like following:

RSpec::Matchers.define :be_json do |expected|
  match do |actual|
    JSON.parse(actual) == expected
  end

  description do
    if html? # to html formatter output this
       "return JSON:\n#{JSON.pretty_generate(expected)}"
    else # for other formats condensed output
      "return JSON:\n#{expected}"
    end
  end
end

I plan to use this running two formatters at same time  -f doc and -f
html at same time to produce pretty HTML file,  and relatively
condensed doc in console.

Big thanks, forward,
Ervin.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to