diff --git a/spec/models/json_version_spec.rb b/spec/models/json_version_spec.rb index c714b379..ac6b0cfc 100644 --- a/spec/models/json_version_spec.rb +++ b/spec/models/json_version_spec.rb @@ -1,11 +1,12 @@ -require 'rails_helper' +if JsonVersion.table_exists? -describe JsonVersion, :type => :model do - it "should include the `VersionConcern` module to get base functionality" do - expect(JsonVersion).to include(PaperTrail::VersionConcern) - end + require 'rails_helper' + + describe JsonVersion, :type => :model do + it "should include the `VersionConcern` module to get base functionality" do + expect(JsonVersion).to include(PaperTrail::VersionConcern) + end - if ENV['DB'] == 'postgres' || JsonVersion.table_exists? describe "Methods" do describe "Class" do @@ -71,8 +72,9 @@ describe JsonVersion, :type => :model do end end end - end + end end + end diff --git a/test/dummy/db/migrate/20110208155312_set_up_test_tables.rb b/test/dummy/db/migrate/20110208155312_set_up_test_tables.rb index e0784ea9..1f7f36e0 100644 --- a/test/dummy/db/migrate/20110208155312_set_up_test_tables.rb +++ b/test/dummy/db/migrate/20110208155312_set_up_test_tables.rb @@ -60,7 +60,7 @@ class SetUpTestTables < ActiveRecord::Migration end add_index :post_versions, [:item_type, :item_id] - if ENV['DB'] == 'postgres' + if ENV['DB'] == 'postgres' && ::ActiveRecord::VERSION::MAJOR >= 4 create_table :json_versions, :force => true do |t| t.string :item_type, :null => false t.integer :item_id, :null => false