Expand VERSION (number) into it's own module to give the version number tracking more modularity
This commit is contained in:
parent
fc0050ab2d
commit
51de996649
|
@ -4,6 +4,7 @@
|
|||
- [#372](https://github.com/airblade/paper_trail/pull/372) - Use [Arel](https://github.com/rails/arel) for SQL construction.
|
||||
- [#347](https://github.com/airblade/paper_trail/pull/347) - Autoload `ActiveRecord` models in via a `Rails::Engine` when
|
||||
the gem is used with `Rails`.
|
||||
- Expand `PaperTrail::VERSION` into a module, mimicking the form used by Rails to give it some additional modularity & versatility.
|
||||
- Fixed `VersionConcern#index` instance method so that it conforms to using the primary key for ordering when possible.
|
||||
|
||||
## 3.0.2
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
module PaperTrail
|
||||
VERSION = '3.0.2'
|
||||
module VERSION
|
||||
MAJOR = 3
|
||||
MINOR = 0
|
||||
TINY = 3
|
||||
PRE = 'alpha'
|
||||
|
||||
STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
|
||||
|
||||
def self.to_s
|
||||
STRING
|
||||
end
|
||||
end
|
||||
|
||||
def self.version
|
||||
VERSION::STRING
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'paper_trail/version_number'
|
|||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = 'paper_trail'
|
||||
s.version = PaperTrail::VERSION
|
||||
s.version = PaperTrail.version
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.summary = "Track changes to your models' data. Good for auditing or versioning."
|
||||
s.description = s.summary
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'PaperTrail::VERSION' do
|
||||
|
||||
describe "Constants" do
|
||||
subject { PaperTrail::VERSION }
|
||||
|
||||
describe :MAJOR do
|
||||
it { should be_const_defined(:MAJOR) }
|
||||
it { subject::MAJOR.should be_a(Integer) }
|
||||
end
|
||||
describe :MINOR do
|
||||
it { should be_const_defined(:MINOR) }
|
||||
it { subject::MINOR.should be_a(Integer) }
|
||||
end
|
||||
describe :TINY do
|
||||
it { should be_const_defined(:TINY) }
|
||||
it { subject::TINY.should be_a(Integer) }
|
||||
end
|
||||
describe :PRE do
|
||||
it { should be_const_defined(:PRE) }
|
||||
if PaperTrail::VERSION::PRE
|
||||
it { subject::PRE.should be_instance_of(String) }
|
||||
end
|
||||
end
|
||||
describe :STRING do
|
||||
it { should be_const_defined(:STRING) }
|
||||
it { subject::STRING.should be_instance_of(String) }
|
||||
|
||||
it "should join the numbers into a period separated string" do
|
||||
subject::STRING.should ==
|
||||
[subject::MAJOR, subject::MINOR, subject::TINY, subject::PRE].compact.join('.')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe PaperTrail do
|
||||
describe :version do
|
||||
it { should respond_to(:version) }
|
||||
its(:version) { should == PaperTrail::VERSION::STRING }
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue