intridea/grape — pull request #619 by danielspector (2014-04-06 21:49:16+00:00)
Title: Convert specs to RSpec 3 syntax with Transpec

Converted suite to RSpec 3 syntax with [Transpec](https://github.com/yujinakayama/transpec).

Additionally, I updated a test from endpoint_spec.rb on Line 108. Test checks whether response cookies are set. Appropriate test would be to check for nil rather than using a match keyword. Previous versions of RSpec would allow checking against nil using the `=~` syntax. RSpec 3 does not allow nil to be checked with the `match` matcher. The test was updated to reflect this change.

Test Before Change:
```ruby
it 'sets browser cookies and does not set response cookies' do
subject.get('/username') do
cookies[:username]
end
get('/username', {}, 'HTTP_COOKIE' => 'username=mrplum; sandbox=true')

last_response.body.should == 'mrplum'
last_response.headers['Set-Cookie'].should_not =~ /username=mrplum/
last_response.headers['Set-Cookie'].should_not =~ /sandbox=true/
end
```

Test After Change:
```ruby
it 'sets browser cookies and does not set response cookies' do
subject.get('/username') do
cookies[:username]
end
get('/username', {}, 'HTTP_COOKIE' => 'username=mrplum; sandbox=true')

expect(last_response.body).to eq('mrplum')
expect(last_response.headers['Set-Cookie']).to be_nil
end
```

This conversion is done by Transpec 1.10.4 with the following command:
transpec

* 826 conversions
from: obj.should
to: expect(obj).to

* 572 conversions
from: == expected
to: eq(expected)

* 23 conversions
from: obj.stub(:message)
to: allow(obj).to receive(:message)

* 17 conversions
from: obj.should_receive(:message)
to: expect(obj).to receive(:message)

* 8 conversions
from: obj.should_not
to: expect(obj).not_to

* 8 conversions
from: =~ /pattern/
to: match(/pattern/)

* 6 conversions
from: lambda { }.should
to: expect { }.to

* 3 conversions
from: lambda { }.should_not
to: expect { }.not_to

* 2 conversions
from: > expected
to: be > expected

* 2 conversions
from: obj.should_not_receive(:message)
to: expect(obj).not_to receive(:message)

* 1 conversion
from: >= expected
to: be >= expected