README.md in rspec-expect_it-1.1.0 vs README.md in rspec-expect_it-2.0.0

- old
+ new

@@ -1,10 +1,13 @@ # RSpec::ExpectIt -[![Build Status](https://travis-ci.org/thomasfedb/rspec-expect_it.png?branch=master)](https://travis-ci.org/thomasfedb/rspec-expect_it) [![Gem Version](https://badge.fury.io/rb/rspec-expect_it.png)](http://badge.fury.io/rb/rspec-expect_it) +[![Build Status](https://travis-ci.org/thomasfedb/rspec-expect_it.png?branch=master)](https://travis-ci.org/thomasfedb/rspec-expect_it) +[![Gem Version](https://badge.fury.io/rb/rspec-expect_it.png)](http://badge.fury.io/rb/rspec-expect_it) +[![Code Climate](https://codeclimate.com/github/thomasfedb/rspec-expect_it.png)](https://codeclimate.com/github/thomasfedb/rspec-expect_it) -Makes writing nice RSpec tests a little easier by providing expect_it helpers. +Makes writing nice RSpec tests a little easier by providing `expect_it` helpers. +These helpers are equivalent to `expect(subject)` and also provide useful variations. Compatible with Ruby 1.9.2 and greater. ## Installation @@ -61,55 +64,32 @@ ``` ### expect_its Calling `expect_its(:method)` is equivalent to `expect(subject.method)`. -There is no `_safe` version of this helper. ```ruby subject { "foobar" } specify { expect_its(:length).to eq 6 } ``` ### expect_its! If you want eager evaluation of the subject and method call, use `expect_its!`. -There is no `_safe` version of this helper. ```ruby subject { @value += 1 } specify { expect_its!(:to_s).to eq @value.to_s } ``` -### expect_it_safe - -The `expect_it_safe` helper is the same as `expect_it`, except that it will -swallow any exceptions and return `nil`. - -```ruby -subject { raise Exception } - -specify { expect_it_safe.to eq nil } -``` - -### expect_it_safe! - -The `expect_it_safe!` helper is the same as `expect_it!`, except that it will -swallow any exceptions and return `nil`. - -```ruby -subject { raise Exception } - -specify { expect_it_safe!.to eq nil } -``` - ### expect_it_safe{} The `expect_it_safe{}` helper is the same as `expect_it{}`, except that it will -swallow any exceptions and return `nil`. +swallow any exceptions. This can be helpful when checking that error scenarios +do not lead to changes that should only occur when the system is successful. ```ruby subject { raise Exception; @value = 12 } specify { expect_it_safe{}.to_not change{@value} } @@ -120,6 +100,6 @@ 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Add your feature and specs. 4. Commit your changes (`git commit -am 'Add some feature'`) 5. Push to the branch (`git push origin my-new-feature`) -6. Create new Pull Request +6. Create new Pull Request \ No newline at end of file