Only execute the JsonVersion tests against ActiveRecord4 since there is no ActiveRecord3 support for it

This commit is contained in:
Ben Atkins 2015-05-07 14:56:28 -04:00
parent 46f1709ab3
commit 916b78897b
2 changed files with 10 additions and 8 deletions

View File

@ -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

View File

@ -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