Sha256: 6615566c5dcbca5398c4c17be94ba2aad3d6c891380539c5ad24936ed77138fa

Contents?: true

Size: 1.81 KB

Versions: 4

Compression:

Stored size: 1.81 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe 'Formtastic::Util' do

  describe '.deprecated_version_of_rails?' do
    
    subject { Formtastic::Util.deprecated_version_of_rails? }
    
    context '4.0.0' do
      before { allow(Formtastic::Util).to receive(:rails_version) { Gem::Version.new("4.0.0") } }
      it 'should be true' do
        expect(subject).to be_truthy
      end
    end

    context '4.0.3' do
      before { allow(Formtastic::Util).to receive(:rails_version) { Gem::Version.new("4.0.3") } }
      it 'should be true' do
        expect(subject).to be_truthy
      end
    end

    context '4.0.4' do
      before { allow(Formtastic::Util).to receive(:rails_version) { Gem::Version.new("4.0.4") } }
      it 'should be false' do
        expect(subject).to be_truthy
      end
    end

    context '4.0.5' do
      before { allow(Formtastic::Util).to receive(:rails_version) { Gem::Version.new("4.0.5") } }
      it 'should be false' do
        expect(subject).to be_truthy
      end
    end

    context '4.1.0' do
      before { allow(Formtastic::Util).to receive(:rails_version) { Gem::Version.new("4.1.1") } }
      it 'should be false' do
        expect(subject).to be_falsey
      end
    end

    context '4.1.1' do
      before { allow(Formtastic::Util).to receive(:rails_version) { Gem::Version.new("4.1.1") } }
      it 'should be false' do
        expect(subject).to be_falsey
      end
    end

    context '4.2.0' do
      before { allow(Formtastic::Util).to receive(:rails_version) { Gem::Version.new("4.1.1") } }
      it 'should be false' do
        expect(subject).to be_falsey
      end
    end

    context '5.0.0' do
      before { allow(Formtastic::Util).to receive(:rails_version) { Gem::Version.new("5.0.0") } }
      it 'should be true' do
        expect(subject).to be_falsey
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
formtastic-3.1.1 spec/util_spec.rb
formtastic-3.1.0 spec/util_spec.rb
formtastic-3.1.0.rc2 spec/util_spec.rb
formtastic-3.1.0.rc1 spec/util_spec.rb