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: 100,855 of 183,445
Downloads: 7,174

Daily

Ranking: 77,834 of 183,436
Downloads: 0

Depended by

RankDownloadsName

Depends on

RankDownloadsName
12,452,771,297bundler
18926,415,788json
35604,313,582activerecord
41572,724,410rails
257143,009,341sqlite3
63169,257,671mocha
1,08632,406,573shoulda

Owners

#GravatarHandle
1iconphene