Add a description method to all the json_spec matchers #22

merged 2 commits into from Feb 24, 2012


None yet

3 participants

col commented Feb 24, 2012

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
      subject { response.body }
      it { should have_json_size(2) }

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 laserlemon merged commit c8c7ea8 into collectiveidea:master Feb 24, 2012

👏 Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment