README.md in smart_rspec-0.1.0 vs README.md in smart_rspec-0.1.1

- old
+ new

@@ -7,12 +7,15 @@ It's time to make your specs even more awesome! SmartRspec adds useful macros and matchers into the RSpec's test suite, so you can quickly define specs for your Rails app and get focused on making things turn into green. ## Installation -Compatible with Ruby 1.9+ +Compatible with: +* Ruby 1.9+ +* ActiveRecord (model macros) + Add this line to your application's Gemfile: gem 'smart_rspec' Execute: @@ -38,25 +41,25 @@ * [Macros](#macros) * [has_attributes](#has_attributes) * [belongs_to, has_one, has_many](#belongs_to-has_one-has_many) * [fails_validation_of](#fails_validation_of) * [Matchers](#matchers) - * ["Be" matchers](#) - * [be_ascending](#be_ascending) - * [be_a_bad_request](#be_a_bad_request) - * [be_a_list_of](#be_a_list_of) + * ["Be" matchers](#be-matchers) * [be_boolean](#be_boolean) - * [be_descending](#be_descending) * [be_email](#be_email) - * [be_image_url](#be_image_url) * [be_url](#be_url) - * ["Have" matchers](#) + * [be_image_url](#be_image_url) + * [be_a_list_of](#be_a_list_of) + * [be_ascending](#be_ascending) + * [be_descending](#be_descending) + * [be_a_bad_request](#be_a_bad_request) + * ["Have" matchers](#have-matchers) * [have](#have) * [have_at_least](#have_at_least) * [have_at_most](#have_at_most) * [have_error_on](#have_error_on) - * [Other matchers](#) + * [Other matchers](#other-matchers) * [include_items](#include_items) ### Macros You will just need to define a valid `subject` to start using SmartRspec's macros in your spec file. @@ -130,69 +133,69 @@ ### Matchers SmartRspec gathers a collection of custom useful matchers: -#### "Be" matchers +#### Be matchers -##### be_ascending +##### be_boolean +``` ruby +it { expect(true).to be_boolean } +it { expect('true').not_to be_boolean } +``` +##### be_email ``` ruby -it { expect([1, 2, 3, 4]).to be_ascending } -it { expect([1, 4, 2, 3]).not_to be_ascending } +it { expect('tiagopog@gmail.com').to be_email } +it { expect('tiagopog@gmail').not_to be_email } ``` -##### be_a_bad_request +##### be_url ``` ruby -context 'unauthenticated' do - subject { get :profile } - it { is_expected.to be_a_bad_request } -end +it { expect('http://adtangerine.com').to be_url } +it { expect('adtangerine.com').not_to be_url } +``` -context 'authenticated' do - before { sign_in user } - subject { get :profile } - it { is_expected.to_not be_a_bad_request } -end +##### be_image_url +``` ruby +it { expect('http://adtangerine.com/foobar.png').to be_image_url } +it { expect('http://adtangerine.com/foobar.jpg').not_to be_image_url(:gif) } +it { expect('http://adtangerine.com/foo/bar').not_to be_image_url } ``` ##### be_a_list_of ``` ruby it { expect(Foo.fetch_api).to be_a_list_of(Foo)) } ``` -##### be_boolean +##### be_ascending + ``` ruby -it { expect(true).to be_boolean } -it { expect('true').not_to be_boolean } +it { expect([1, 2, 3, 4]).to be_ascending } +it { expect([1, 4, 2, 3]).not_to be_ascending } ``` ##### be_descending ``` ruby it { expect([4, 3, 2, 1]).to be_descending } it { expect([1, 2, 3, 4]).not_to be_descending } ``` -##### be_email +##### be_a_bad_request ``` ruby -it { expect('tiagopog@gmail.com').to be_email } -it { expect('tiagopog@gmail').not_to be_email } -``` +context 'unauthenticated' do + subject { get :profile } + it { is_expected.to be_a_bad_request } +end -##### be_image_url -``` ruby -it { expect('http://adtangerine.com/foobar.png').to be_image_url } -it { expect('http://adtangerine.com/foobar.jpg').not_to be_image_url(:gif) } -it { expect('http://adtangerine.com/foo/bar').not_to be_image_url } +context 'authenticated' do + before { sign_in user } + subject { get :profile } + it { is_expected.to_not be_a_bad_request } +end ``` -##### be_url -``` ruby -it { expect('http://adtangerine.com').to be_url } -it { expect('adtangerine.com').not_to be_url } -``` - -#### "Have" matchers +#### Have matchers ##### have(x).items ``` ruby it { expect([1]).to have(1).item } it { expect(%w(foo bar)).to have(2).items }