Commit 3b99151b by Jon Yurek

Only run metaclass specs if AS > 4.1 or Ruby < 2.1

parent de693b41
...@@ -10,6 +10,8 @@ gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby ...@@ -10,6 +10,8 @@ gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
gem 'rubysl', :platforms => :rbx gem 'rubysl', :platforms => :rbx
gem 'racc', :platforms => :rbx gem 'racc', :platforms => :rbx
gem 'pry'
# Hinting at development dependencies # Hinting at development dependencies
# Prevents bundler from taking a long-time to resolve # Prevents bundler from taking a long-time to resolve
group :development, :test do group :development, :test do
......
...@@ -2,27 +2,29 @@ require 'spec_helper' ...@@ -2,27 +2,29 @@ require 'spec_helper'
describe 'Metaclasses' do describe 'Metaclasses' do
context "A meta-class of dummy" do context "A meta-class of dummy" do
before do if active_support_version >= "4.1" || ruby_version < "2.1"
rebuild_model("Dummy") before do
reset_class("Dummy") rebuild_model("Dummy")
end reset_class("Dummy")
end
it "is able to use Paperclip like a normal class" do it "is able to use Paperclip like a normal class" do
@dummy = Dummy.new @dummy = Dummy.new
assert_nothing_raised do assert_nothing_raised do
rebuild_meta_class_of(@dummy) rebuild_meta_class_of(@dummy)
end
end end
end
it "works like any other instance" do it "works like any other instance" do
@dummy = Dummy.new @dummy = Dummy.new
rebuild_meta_class_of(@dummy) rebuild_meta_class_of(@dummy)
assert_nothing_raised do assert_nothing_raised do
@dummy.avatar = File.new(fixture_file("5k.png"), 'rb') @dummy.avatar = File.new(fixture_file("5k.png"), 'rb')
end
assert @dummy.save
end end
assert @dummy.save
end end
end end
end end
...@@ -10,6 +10,8 @@ require 'ostruct' ...@@ -10,6 +10,8 @@ require 'ostruct'
ROOT = Pathname(File.expand_path(File.join(File.dirname(__FILE__), '..'))) ROOT = Pathname(File.expand_path(File.join(File.dirname(__FILE__), '..')))
puts "Testing against version #{ActiveRecord::VERSION::STRING}"
$LOAD_PATH << File.join(ROOT, 'lib') $LOAD_PATH << File.join(ROOT, 'lib')
$LOAD_PATH << File.join(ROOT, 'lib', 'paperclip') $LOAD_PATH << File.join(ROOT, 'lib', 'paperclip')
require File.join(ROOT, 'lib', 'paperclip.rb') require File.join(ROOT, 'lib', 'paperclip.rb')
...@@ -29,6 +31,7 @@ RSpec.configure do |config| ...@@ -29,6 +31,7 @@ RSpec.configure do |config|
config.include Assertions config.include Assertions
config.include ModelReconstruction config.include ModelReconstruction
config.include TestData config.include TestData
config.extend VersionHelper
config.extend RailsHelpers::ClassMethods config.extend RailsHelpers::ClassMethods
config.mock_framework = :mocha config.mock_framework = :mocha
config.before(:all) do config.before(:all) do
......
module VersionHelper
def active_support_version
ActiveSupport::VERSION::STRING
end
def ruby_version
RUBY_VERSION
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment