collectiveidea / json_spec

Easily handle JSON in RSpec and Cucumber
rubygems.org/gems/json_spec
MIT License
919 stars 114 forks source link

Add a description method to all the json_spec matchers #22

Closed col closed 12 years ago

col commented 12 years ago

I started using json_spec today and discovered that it didn't work well in rspec when using the subject shorthand.

    describe "GET index as JSON" do
      before :each do
        get :index, :format => :json
      end
      subject { response.body }
      it { should have_json_size(2) }
    end

As the 'it' block doesn't include a description it relies on the matcher to have a description method so that rspec can provided some useful output.

I've added a simple description method to each of the json_spec matchers and provided spec for each.

This is the first time I've submitted a pull request so let me know if I need to provide some more info.

laserlemon commented 12 years ago

:clap: Thank you!