Categories: None [Edit]

socialcast_shoulda_ext

https://rubygems.org/gems/socialcast_shoulda_ext
https://github.com/socialcast/socialcast-shoulda-ext
{Build Status}[http://travis-ci.org/socialcast/socialcast-shoulda-ext] = Socialcast Shoulda Extensions Adds new matchers and functionality to the shoulda test library = Installation In your Gemfile: group :test do gem 'socialcast_shoulda_ext', :git => '[email protected]:socialcast/socialcast-shoulda-ext.git', :require => 'shoulda_ext' end If you want to include the trigger_callbacks matcher, also add the following to your test helper: ShouldaExt::Matchers::TriggerCallbackMatcher.attach_active_record_callback_hooks! = Matchers == RecordCountChangeMatcher Test if the count for a model has changed, and by how much. Requires the context_with_matcher_before_hooks patch, which is included by default. Provides the following matcher methods: - create_record(klass_or_symbol) Alias for change_record_count.for(klass_or_symbol).by(1) - create_records(klass_or_symbol, amount) Alias for change_record_count.for(klass_or_symbol).by(amount) - destroy_record(klass_or_symbol) Alias for change_record_count.for(klass_or_symbol).by(-1) - destroy_records(klass_or_symbol, amount) Alias for change_record_count.for(klass_or_symbol).by(-amount) - change_record_count Tests the difference in record count before and after the current setup/subject block Can be used with the follow methods: - for(klass_or_symbol) Provides the class which the test is being performed on. Can be a constant or a symbol - by(amount) Provides an expected difference for the number of records for the specified class. Excluding this number will allow the matcher to check for any difference Examples: context "creating a blog article" do context "with good parameters" do setup do post :create, :blog => {:title => 'my blog post', :body => 'Ipsum lorem...'} end should create_record :blog end context "without a body" do setup do post :create, :blog => {:title => '...

Total

Ranking: 99,514 of 180,671
Downloads: 6,976

Daily

Ranking: 91,966 of 180,660
Downloads: 2

Depended by

RankDownloadsName

Depends on

RankDownloadsName
12,101,349,740bundler
17818,560,042json
34544,188,711activerecord
42518,265,236rails
238133,206,073sqlite3
61961,365,570mocha
1,07328,384,358shoulda

Owners

#GravatarHandle
1iconphene