From 1017159fa051a78daa9dc2743dd4d70a7a656c68 Mon Sep 17 00:00:00 2001 From: Chris Nicola Date: Mon, 4 Feb 2013 15:03:05 -0800 Subject: [PATCH] Fixes most of the tests (with one exception from SQLLite) --- paper_trail.gemspec | 3 +- .../app/controllers/widgets_controller.rb | 4 +- test/functional/thread_safety_test.rb | 2 +- test/test_helper.rb | 2 +- test/unit/inheritance_column_test.rb | 2 +- test/unit/model_test.rb | 172 +++++++++--------- test/unit/serializer_test.rb | 4 +- test/unit/serializers/json_test.rb | 4 +- test/unit/serializers/mixin_json_test.rb | 4 +- test/unit/serializers/mixin_yaml_test.rb | 4 +- test/unit/serializers/yaml_test.rb | 4 +- test/unit/version_test.rb | 6 +- 12 files changed, 105 insertions(+), 106 deletions(-) diff --git a/paper_trail.gemspec b/paper_trail.gemspec index 75040b72..d186f747 100644 --- a/paper_trail.gemspec +++ b/paper_trail.gemspec @@ -19,7 +19,6 @@ Gem::Specification.new do |s| s.add_dependency 'activerecord', '~> 4.0.0.beta' s.add_development_dependency 'rake' - s.add_development_dependency 'shoulda', '~> 3.3' - s.add_development_dependency 'sqlite3', '~> 1.2' + s.add_development_dependency 'sqlite3' s.add_development_dependency 'ffaker', '>= 1.15' end diff --git a/test/dummy/app/controllers/widgets_controller.rb b/test/dummy/app/controllers/widgets_controller.rb index 7320d09d..e41e1411 100644 --- a/test/dummy/app/controllers/widgets_controller.rb +++ b/test/dummy/app/controllers/widgets_controller.rb @@ -5,13 +5,13 @@ class WidgetsController < ApplicationController end def create - @widget = Widget.create params[:widget] + @widget = Widget.create params[:widget].permit! head :ok end def update @widget = Widget.find params[:id] - @widget.update_attributes params[:widget] + @widget.update_attributes params[:widget].permit! head :ok end diff --git a/test/functional/thread_safety_test.rb b/test/functional/thread_safety_test.rb index 7bde5643..800066ee 100644 --- a/test/functional/thread_safety_test.rb +++ b/test/functional/thread_safety_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class ThreadSafetyTest < ActionController::TestCase - should "be thread safe" do + test "be thread safe" do blocked = true slow_thread = Thread.new do diff --git a/test/test_helper.rb b/test/test_helper.rb index c37590bb..fb4a8a2c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -3,6 +3,7 @@ ENV["RAILS_ENV"] = "test" require File.expand_path("../dummy/config/environment.rb", __FILE__) require "rails/test_help" +require "minitest/autorun" #ActionMailer::Base.delivery_method = :test #ActionMailer::Base.perform_deliveries = true @@ -10,7 +11,6 @@ require "rails/test_help" Rails.backtrace_cleaner.remove_silencers! -require 'shoulda' require 'ffaker' # Run any available migration diff --git a/test/unit/inheritance_column_test.rb b/test/unit/inheritance_column_test.rb index 6ae94089..67f08bf2 100644 --- a/test/unit/inheritance_column_test.rb +++ b/test/unit/inheritance_column_test.rb @@ -2,7 +2,7 @@ require 'test_helper' class InheritanceColumnTest < ActiveSupport::TestCase - context 'STI models' do + describe 'STI models' do setup do @animal = Animal.create :name => 'Animal' @animal.update_attributes :name => 'Animal from the Muppets' diff --git a/test/unit/model_test.rb b/test/unit/model_test.rb index 76b8300b..74163806 100644 --- a/test/unit/model_test.rb +++ b/test/unit/model_test.rb @@ -2,16 +2,16 @@ require 'test_helper' class HasPaperTrailModelTest < ActiveSupport::TestCase - context 'A record with defined "only" and "ignore" attributes' do + describe "A record with defined 'only' and 'ignore' attributes" do setup { @article = Article.create } should 'creation should change the number of versions' do assert_equal(1, Version.count) end - context 'which updates an ignored column' do + describe 'which updates an ignored column' do setup { @article.update_attributes :title => 'My first title' } should 'not change the number of versions' do assert_equal(1, Version.count) end end - context 'which updates an ignored column and a selected column' do + describe 'which updates an ignored column and a selected column' do setup { @article.update_attributes :title => 'My first title', :content => 'Some text here.' } should 'change the number of versions' do assert_equal(2, Version.count) end @@ -24,7 +24,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'which updates a selected column' do + describe 'which updates a selected column' do setup { @article.update_attributes :content => 'Some text here.' } should 'change the number of versions' do assert_equal(2, Version.count) end @@ -33,17 +33,17 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'which updates a non-ignored and non-selected column' do + describe 'which updates a non-ignored and non-selected column' do setup { @article.update_attributes :abstract => 'Other abstract'} should 'not change the number of versions' do assert_equal(1, Version.count) end end - context 'which updates a skipped column' do + describe 'which updates a skipped column' do setup { @article.update_attributes :file_upload => 'Your data goes here' } should 'not change the number of versions' do assert_equal(1, Version.count) end end - context 'which updates a skipped column and a selected column' do + describe 'which updates a skipped column and a selected column' do setup { @article.update_attributes :file_upload => 'Your data goes here', :content => 'Some text here.' } should 'change the number of versions' do assert_equal(2, Version.count) end @@ -55,7 +55,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase assert_equal ({'content' => [nil, 'Some text here.']}), @article.versions.last.changeset end - context 'and when updated again' do + describe 'and when updated again' do setup do @article.update_attributes :file_upload => 'More data goes here', :content => 'More text here.' @old_article = @article.versions.last @@ -71,7 +71,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'which gets destroyed' do + describe 'which gets destroyed' do setup { @article.destroy } should 'change the number of versions' do assert_equal(2, Version.count) end @@ -81,37 +81,37 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'A record with defined "ignore" attribute' do + describe "A record with defined 'ignore' attribute" do setup { @legacy_widget = LegacyWidget.create } - context 'which updates an ignored column' do + describe 'which updates an ignored column' do setup { @legacy_widget.update_attributes :version => 1 } should 'not change the number of versions' do assert_equal(1, Version.count) end end end - context 'A record with defined "if" and "unless" attributes' do + describe 'A record with defined "if" and "unless" attributes' do setup { @translation = Translation.new :headline => 'Headline' } - context 'for non-US translations' do + describe 'for non-US translations' do setup { @translation.save } should 'not change the number of versions' do assert_equal(0, Version.count) end - context 'after update' do + describe 'after update' do setup { @translation.update_attributes :content => 'Content' } should 'not change the number of versions' do assert_equal(0, Version.count) end end - context 'after destroy' do + describe 'after destroy' do setup { @translation.destroy } should 'not change the number of versions' do assert_equal(0, Version.count) end end end - context 'for US translations' do + describe 'for US translations' do setup { @translation.language_code = "US" } - context 'that are drafts' do + describe 'that are drafts' do setup do @translation.type = 'DRAFT' @translation.save @@ -119,18 +119,18 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase should 'not change the number of versions' do assert_equal(0, Version.count) end - context 'after update' do + describe 'after update' do setup { @translation.update_attributes :content => 'Content' } should 'not change the number of versions' do assert_equal(0, Version.count) end end end - context 'that are not drafts' do + describe 'that are not drafts' do setup { @translation.save } should 'change the number of versions' do assert_equal(1, Version.count) end - context 'after update' do + describe 'after update' do setup { @translation.update_attributes :content => 'Content' } should 'change the number of versions' do assert_equal(2, Version.count) end @@ -139,7 +139,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'after destroy' do + describe 'after destroy' do setup { @translation.destroy } should 'change the number of versions' do assert_equal(2, Version.count) end @@ -151,7 +151,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'A new record' do + describe 'A new record' do setup { @widget = Widget.new } should 'not have any previous versions' do @@ -163,7 +163,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context 'which is then created' do + describe 'which is then created' do setup { @widget.update_attributes :name => 'Henry' } should 'have one previous version' do @@ -194,7 +194,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase assert_equal changes, @widget.versions.last.changeset end - context 'and then updated without any changes' do + describe 'and then updated without any changes' do setup { @widget.touch } should 'not have a new version' do @@ -203,7 +203,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context 'and then updated with changes' do + describe 'and then updated with changes' do setup { @widget.update_attributes :name => 'Harry' } should 'have two previous versions' do @@ -257,7 +257,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'and has one associated object' do + describe 'and has one associated object' do setup do @wotsit = @widget.create_wotsit :name => 'John' end @@ -276,7 +276,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context 'and has many associated objects' do + describe 'and has many associated objects' do setup do @f0 = @widget.fluxors.create :name => 'f-zero' @f1 = @widget.fluxors.create :name => 'f-one' @@ -293,7 +293,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context 'and then destroyed' do + describe 'and then destroyed' do setup do @fluxor = @widget.fluxors.create :name => 'flux' @widget.destroy @@ -333,7 +333,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase # Test the serialisation and deserialisation. # TODO: binary - context "A record's papertrail" do + describe "A record's papertrail" do setup do @date_time = DateTime.now.utc @time = Time.now @@ -397,7 +397,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context "after a column is removed from the record's schema" do + describe "after a column is removed from the record's schema" do setup do change_schema Widget.connection.schema_cache.clear! @@ -425,10 +425,10 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context 'A record' do + describe 'A record' do setup { @widget = Widget.create :name => 'Zaphod' } - context 'with PaperTrail globally disabled' do + describe 'with PaperTrail globally disabled' do setup do PaperTrail.enabled = false @count = @widget.versions.length @@ -436,7 +436,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase teardown { PaperTrail.enabled = true } - context 'when updated' do + describe 'when updated' do setup { @widget.update_attributes :name => 'Beeblebrox' } should 'not add to its trail' do @@ -445,7 +445,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'with its paper trail turned off' do + describe 'with its paper trail turned off' do setup do Widget.paper_trail_off @count = @widget.versions.length @@ -453,7 +453,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase teardown { Widget.paper_trail_on } - context 'when updated' do + describe 'when updated' do setup { @widget.update_attributes :name => 'Beeblebrox' } should 'not add to its trail' do @@ -461,17 +461,17 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'when destroyed "without versioning"' do + describe 'when destroyed "without versioning"' do should 'leave paper trail off after call' do @widget.without_versioning :destroy assert !Widget.paper_trail_enabled_for_model end end - context 'and then its paper trail turned on' do + describe 'and then its paper trail turned on' do setup { Widget.paper_trail_on } - context 'when updated' do + describe 'when updated' do setup { @widget.update_attributes :name => 'Ford' } should 'add to its trail' do @@ -479,7 +479,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'when updated "without versioning"' do + describe 'when updated "without versioning"' do setup do @widget.without_versioning do @widget.update_attributes :name => 'Ford' @@ -499,12 +499,12 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context 'A papertrail with somebody making changes' do + describe 'A papertrail with somebody making changes' do setup do @widget = Widget.new :name => 'Fidget' end - context 'when a record is created' do + describe 'when a record is created' do setup do PaperTrail.whodunnit = 'Alice' @widget.save @@ -518,7 +518,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase assert_equal 'Alice', @widget.originator end - context 'when a record is updated' do + describe 'when a record is updated' do setup do PaperTrail.whodunnit = 'Bob' @widget.update_attributes :name => 'Rivet' @@ -532,7 +532,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase assert_equal 'Bob', @widget.originator end - context 'when a record is destroyed' do + describe 'when a record is destroyed' do setup do PaperTrail.whodunnit = 'Charlie' @widget.destroy @@ -551,7 +551,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context 'A subclass' do + describe 'A subclass' do setup do @foo = FooWidget.create @foo.update_attributes :name => 'Fooey' @@ -570,7 +570,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase assert_equal PaperTrail.whodunnit, @foo.originator end - context 'when destroyed' do + describe 'when destroyed' do setup { @foo.destroy } should 'reify with the correct type' do @@ -583,14 +583,14 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context 'An item with versions' do + describe 'An item with versions' do setup do @widget = Widget.create :name => 'Widget' @widget.update_attributes :name => 'Fidget' @widget.update_attributes :name => 'Digit' end - context 'which were created over time' do + describe 'which were created over time' do setup do @created = 2.days.ago @first_update = 1.day.ago @@ -630,7 +630,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context '.versions_between' do + describe '.versions_between' do setup do @created = 30.days.ago @first_update = 15.days.ago @@ -649,7 +649,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'on the first version' do + describe 'on the first version' do setup { @version = @widget.versions.first } should 'have a nil previous version' do @@ -665,7 +665,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'on the last version' do + describe 'on the last version' do setup { @version = @widget.versions.last } should 'return the previous version' do @@ -683,13 +683,13 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context 'An item' do + describe 'An item' do setup do @initial_title = 'Foobar' @article = Article.new :title => @initial_title end - context 'which is created' do + describe 'which is created' do setup { @article.save } should 'store fixed meta data' do @@ -713,7 +713,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context 'and updated' do + describe 'and updated' do setup do @article.update_attributes! :content => 'Better text.', :title => 'Rhubarb' end @@ -736,7 +736,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context 'and destroyed' do + describe 'and destroyed' do setup { @article.destroy } should 'store fixed meta data' do @@ -758,7 +758,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'A reified item' do + describe 'A reified item' do setup do widget = Widget.create :name => 'Bob' %w( Tom Dick Jane ).each { |name| widget.update_attributes :name => name } @@ -777,7 +777,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context 'A non-reified item' do + describe 'A non-reified item' do setup { @widget = Widget.new } should 'not have a previous version' do @@ -788,7 +788,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase assert_nil @widget.next_version end - context 'with versions' do + describe 'with versions' do setup do @widget.save %w( Tom Dick Jane ).each { |name| @widget.update_attributes :name => name } @@ -804,7 +804,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'A reified item' do + describe 'A reified item' do setup do widget = Widget.create :name => 'Bob' %w( Tom Dick Jane ).each { |name| widget.update_attributes :name => name } @@ -824,7 +824,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context ":has_many :through" do + describe ":has_many :through" do setup do @book = Book.create :title => 'War and Peace' @dostoyevsky = Person.create :name => 'Dostoyevsky' @@ -865,16 +865,16 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context 'A model with a has_one association' do + describe 'A model with a has_one association' do setup { @widget = Widget.create :name => 'widget_0' } - context 'before the associated was created' do + describe 'before the associated was created' do setup do @widget.update_attributes :name => 'widget_1' @wotsit = @widget.create_wotsit :name => 'wotsit_0' end - context 'when reified' do + describe 'when reified' do setup { @widget_0 = @widget.versions.last.reify(:has_one => 1) } should 'see the associated as it was at the time' do @@ -883,7 +883,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'where the associated is created between model versions' do + describe 'where the associated is created between model versions' do setup do @wotsit = @widget.create_wotsit :name => 'wotsit_0' make_last_version_earlier @wotsit @@ -891,7 +891,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase @widget.update_attributes :name => 'widget_1' end - context 'when reified' do + describe 'when reified' do setup { @widget_0 = @widget.versions.last.reify(:has_one => 1) } should 'see the associated as it was at the time' do @@ -899,7 +899,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'and then the associated is updated between model versions' do + describe 'and then the associated is updated between model versions' do setup do @wotsit.update_attributes :name => 'wotsit_1' make_last_version_earlier @wotsit @@ -910,7 +910,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase @wotsit.update_attributes :name => 'wotsit_3' end - context 'when reified' do + describe 'when reified' do setup { @widget_1 = @widget.versions.last.reify(:has_one => 1) } should 'see the associated as it was at the time' do @@ -918,7 +918,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'when reified opting out of has_one reification' do + describe 'when reified opting out of has_one reification' do setup { @widget_1 = @widget.versions.last.reify(:has_one => false) } should 'see the associated as it is live' do @@ -927,7 +927,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'and then the associated is destroyed between model versions' do + describe 'and then the associated is destroyed between model versions' do setup do @wotsit.destroy make_last_version_earlier @wotsit @@ -935,7 +935,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase @widget.update_attributes :name => 'widget_3' end - context 'when reified' do + describe 'when reified' do setup { @widget_2 = @widget.versions.last.reify(:has_one => 1) } should 'see the associated as it was at the time' do @@ -946,14 +946,14 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'When an attribute has a custom serializer' do + describe 'When an attribute has a custom serializer' do setup { @person = Person.new(:time_zone => "Samoa") } should "be an instance of ActiveSupport::TimeZone" do assert_equal ActiveSupport::TimeZone, @person.time_zone.class end - context 'when the model is saved' do + describe 'when the model is saved' do setup do @changes_before_save = @person.changes.dup @person.save! @@ -982,7 +982,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase assert_equal [NilClass, ActiveSupport::TimeZone], @person.versions.last.changeset[:time_zone].map(&:class) end - context 'when that attribute is updated' do + describe 'when that attribute is updated' do setup do @attribute_value_before_change = @person.instance_variable_get(:@attributes)['time_zone'] @person.assign_attributes({ :time_zone => 'Pacific Time (US & Canada)' }) @@ -1030,21 +1030,21 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context 'A new model instance which uses a custom Version class' do + describe 'A new model instance which uses a custom Version class' do setup { @post = Post.new } - context 'which is then saved' do + describe 'which is then saved' do setup { @post.save } should 'change the number of post versions' do assert_equal 1, PostVersion.count end should 'not change the number of versions' do assert_equal(0, Version.count) end end end - context 'An existing model instance which uses a custom Version class' do + describe 'An existing model instance which uses a custom Version class' do setup { @post = Post.create } should 'have one post version' do assert_equal(1, PostVersion.count) end - context 'on the first version' do + describe 'on the first version' do setup { @version = @post.versions.first } should 'have the correct index' do @@ -1056,7 +1056,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase assert_equal "PostVersion", @post.versions.first.class.name end - context 'which is modified' do + describe 'which is modified' do setup { @post.update_attributes({ :content => "Some new content" }) } should 'change the number of post versions' do assert_equal(2, PostVersion.count) end should 'not change the number of versions' do assert_equal(0, Version.count) end @@ -1067,7 +1067,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context 'An overwritten default accessor' do + describe 'An overwritten default accessor' do setup do @song = Song.create :length => 4 @song.update_attributes :length => 5 @@ -1082,7 +1082,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end - context 'An unsaved record' do + describe 'An unsaved record' do setup do @widget = Widget.new @widget.destroy @@ -1092,7 +1092,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'A model with a custom association' do + describe 'A model with a custom association' do setup do @doc = Document.create @doc.update_attributes :name => 'Doc 1' @@ -1113,8 +1113,8 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'The `on` option' do - context 'on create' do + describe 'The `on` option' do + describe 'on create' do setup do Fluxor.instance_eval <<-END has_paper_trail :on => [:create] @@ -1128,7 +1128,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase assert_equal 'create', @fluxor.versions.last.event end end - context 'on update' do + describe 'on update' do setup do Fluxor.reset_callbacks :create Fluxor.reset_callbacks :update @@ -1145,7 +1145,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase assert_equal 'update', @fluxor.versions.last.event end end - context 'on destroy' do + describe 'on destroy' do setup do Fluxor.reset_callbacks :create Fluxor.reset_callbacks :update @@ -1164,7 +1164,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'A model with column version and custom version_method' do + describe 'A model with column version and custom version_method' do setup do @legacy_widget = LegacyWidget.create(:name => "foo", :version => 2) end @@ -1183,7 +1183,7 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase end end - context 'A reified item with a column -version- and custom version_method' do + describe 'A reified item with a column -version- and custom version_method' do setup do widget = LegacyWidget.create(:name => "foo", :version => 2) %w( bar baz ).each { |name| widget.update_attributes :name => name } diff --git a/test/unit/serializer_test.rb b/test/unit/serializer_test.rb index 4d9a9b67..6a466fef 100644 --- a/test/unit/serializer_test.rb +++ b/test/unit/serializer_test.rb @@ -2,7 +2,7 @@ require 'test_helper' class SerializerTest < ActiveSupport::TestCase - context 'YAML Serializer' do + describe 'YAML Serializer' do setup do Fluxor.instance_eval <<-END has_paper_trail @@ -26,7 +26,7 @@ class SerializerTest < ActiveSupport::TestCase end end - context 'Custom Serializer' do + describe 'Custom Serializer' do setup do PaperTrail.configure do |config| config.serializer = PaperTrail::Serializers::Json diff --git a/test/unit/serializers/json_test.rb b/test/unit/serializers/json_test.rb index bfc000c3..618e2d08 100644 --- a/test/unit/serializers/json_test.rb +++ b/test/unit/serializers/json_test.rb @@ -15,7 +15,7 @@ class JsonTest < ActiveSupport::TestCase @array_as_json = @array.to_json end - context '`load` class method' do + describe '`load` class method' do should 'exist' do assert PaperTrail::Serializers::Json.respond_to?(:load) end @@ -26,7 +26,7 @@ class JsonTest < ActiveSupport::TestCase end end - context '`dump` class method' do + describe '`dump` class method' do should 'exist' do assert PaperTrail::Serializers::Json.respond_to?(:dump) end diff --git a/test/unit/serializers/mixin_json_test.rb b/test/unit/serializers/mixin_json_test.rb index 42af8b50..b5f27f1b 100644 --- a/test/unit/serializers/mixin_json_test.rb +++ b/test/unit/serializers/mixin_json_test.rb @@ -26,7 +26,7 @@ class MixinJsonTest < ActiveSupport::TestCase @hash_as_json = @hash.to_json end - context '`load` class method' do + describe '`load` class method' do should 'exist' do assert CustomJsonSerializer.respond_to?(:load) end @@ -36,7 +36,7 @@ class MixinJsonTest < ActiveSupport::TestCase end end - context '`dump` class method' do + describe '`dump` class method' do should 'exist' do assert CustomJsonSerializer.respond_to?(:dump) end diff --git a/test/unit/serializers/mixin_yaml_test.rb b/test/unit/serializers/mixin_yaml_test.rb index 273b5dee..a44e84f7 100644 --- a/test/unit/serializers/mixin_yaml_test.rb +++ b/test/unit/serializers/mixin_yaml_test.rb @@ -26,7 +26,7 @@ class MixinYamlTest < ActiveSupport::TestCase @hash_as_yaml = @hash.to_yaml end - context '`load` class method' do + describe '`load` class method' do should 'exist' do assert CustomYamlSerializer.respond_to?(:load) end @@ -36,7 +36,7 @@ class MixinYamlTest < ActiveSupport::TestCase end end - context '`dump` class method' do + describe '`dump` class method' do should 'exist' do assert CustomYamlSerializer.respond_to?(:dump) end diff --git a/test/unit/serializers/yaml_test.rb b/test/unit/serializers/yaml_test.rb index 614203c4..2ea35bb6 100644 --- a/test/unit/serializers/yaml_test.rb +++ b/test/unit/serializers/yaml_test.rb @@ -15,7 +15,7 @@ class YamlTest < ActiveSupport::TestCase @array_as_yaml = @array.to_yaml end - context '`load` class method' do + describe '`load` class method' do should 'exist' do assert PaperTrail::Serializers::Yaml.respond_to?(:load) end @@ -26,7 +26,7 @@ class YamlTest < ActiveSupport::TestCase end end - context '`dump` class method' do + describe '`dump` class method' do should 'exist' do assert PaperTrail::Serializers::Yaml.respond_to?(:dump) end diff --git a/test/unit/version_test.rb b/test/unit/version_test.rb index 4fc8bca0..a37ea718 100644 --- a/test/unit/version_test.rb +++ b/test/unit/version_test.rb @@ -7,7 +7,7 @@ class VersionTest < ActiveSupport::TestCase assert Version.creates.present? } - context "Version.creates" do + describe "Version.creates" do should "return only create events" do Version.creates.each do |version| assert_equal "create", version.event @@ -15,7 +15,7 @@ class VersionTest < ActiveSupport::TestCase end end - context "Version.updates" do + describe "Version.updates" do setup { @article.update_attributes(:name => 'Animal') assert Version.updates.present? @@ -28,7 +28,7 @@ class VersionTest < ActiveSupport::TestCase end end - context "Version.destroys" do + describe "Version.destroys" do setup { @article.destroy assert Version.destroys.present?