mas-rad_core 0.0.87 → 0.0.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f93ce7b6885ad6d9b582c9ef6ec886d23912a26
4
- data.tar.gz: 757ea1c73bd9542f9c86ce072506e6d7a4b29047
3
+ metadata.gz: 38b9c7f5588aef51cc80e47e9c953908931c4eda
4
+ data.tar.gz: c3ed57a917ac38c63906b70563c092d36b8de3fa
5
5
  SHA512:
6
- metadata.gz: 7e41e6db02eae6148af58e24ecd147a96e144b2a74a2f43f706bea59f942062e98a604c7ccdc947e4a8a3dc0c6ccfe10f35f8e92afe324aed4357ef6438019fc
7
- data.tar.gz: 92eb940bed3e42fd68c707c4bdc01ac7dc794f216e7483ab8609fa680c9d549a8e45abc9f232df167c87ebc3ee820b50dfb37c6a62000b2e336476b55f9648ab
6
+ metadata.gz: 1414e7800949b42615ef27c073f23771b58169cea824f5433a5a3e9423858366e958490d126d7aa28a42a822fe33e7d4546b56bfbe0ad339b337981c8a262076
7
+ data.tar.gz: 02fc0382900832baa5d9b89d6e1e364181896e8fcf41e6e8f84687f98a3228ff408faf626b09556f208d0431571f551c61ec6dee210e37cb8ea7c1a349ab6a0e
@@ -7,4 +7,12 @@ class InvestmentSize < ActiveRecord::Base
7
7
  validates_presence_of :name
8
8
 
9
9
  default_scope { order(:order) }
10
+
11
+ def self.lowest
12
+ first
13
+ end
14
+
15
+ def lowest?
16
+ self == self.class.lowest
17
+ end
10
18
  end
@@ -1,5 +1,5 @@
1
1
  module MAS
2
2
  module RadCore
3
- VERSION = '0.0.87'
3
+ VERSION = '0.0.88'
4
4
  end
5
5
  end
Binary file
@@ -2,4 +2,39 @@ RSpec.describe InvestmentSize do
2
2
  it_behaves_like 'reference data'
3
3
  it_behaves_like 'translatable'
4
4
  it_behaves_like 'friendly named'
5
+
6
+ context 'identifying the lowest defined value' do
7
+ let(:lower_limit_ordinal) { 1 }
8
+ let(:upper_limit_ordinal) { 5 }
9
+ let(:ordinals) { (lower_limit_ordinal..upper_limit_ordinal).to_a }
10
+ before do
11
+ # Reversing the ordinals so the default sort order is not the same as the
12
+ # order of creation and so hopefully prove we are not dependent on DB
13
+ # allocated IDs in any way
14
+ ordinals.reverse.each do |ordinal|
15
+ FactoryGirl.create(:investment_size, order: ordinal)
16
+ end
17
+ end
18
+
19
+ describe '.lowest' do
20
+ it 'returns the investment size with the lowest order value' do
21
+ expect(described_class.lowest.order).to eq(lower_limit_ordinal)
22
+ end
23
+ end
24
+
25
+ describe '#lowest?' do
26
+ let(:record) { described_class.find_by(order: ordinal) }
27
+ subject { record.lowest? }
28
+
29
+ context 'when the subject is the lowest value' do
30
+ let(:ordinal) { lower_limit_ordinal }
31
+ it { is_expected.to be(true) }
32
+ end
33
+
34
+ context 'when the subject is not the lowest value' do
35
+ let(:ordinal) { upper_limit_ordinal }
36
+ it { is_expected.to be(false) }
37
+ end
38
+ end
39
+ end
5
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mas-rad_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.87
4
+ version: 0.0.88
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Lovell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-22 00:00:00.000000000 Z
11
+ date: 2015-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails