diff options
author | micael.bergeron <micaelbergeron@gmail.com> | 2017-11-06 10:20:20 -0500 |
---|---|---|
committer | micael.bergeron <micaelbergeron@gmail.com> | 2017-11-06 10:20:20 -0500 |
commit | d934d6504a9f1a706dbfc0b4a28c4cf8dbe8c8eb (patch) | |
tree | 0eb1d96ae44f2394c1dfb3bcb5a22af4802acccf /spec/models | |
parent | 5ab3ed7a9ad16ad20fd3341a02b597697644ea3f (diff) | |
download | gitlab-ce-d934d6504a9f1a706dbfc0b4a28c4cf8dbe8c8eb.tar.gz |
updated the ignore_column concern to support multiple columns
This method is an ActiveRecord extension and it should behave
like one. I expected this to work.
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/concerns/ignorable_column_spec.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/models/concerns/ignorable_column_spec.rb b/spec/models/concerns/ignorable_column_spec.rb index dba9fe43327..b70f2331a0e 100644 --- a/spec/models/concerns/ignorable_column_spec.rb +++ b/spec/models/concerns/ignorable_column_spec.rb @@ -5,7 +5,11 @@ describe IgnorableColumn do Class.new do def self.columns # This method does not have access to "double" - [Struct.new(:name).new('id'), Struct.new(:name).new('title')] + [ + Struct.new(:name).new('id'), + Struct.new(:name).new('title'), + Struct.new(:name).new('date') + ] end end end @@ -18,7 +22,7 @@ describe IgnorableColumn do describe '.columns' do it 'returns the columns, excluding the ignored ones' do - model.ignore_column(:title) + model.ignore_column(:title, :date) expect(model.columns.map(&:name)).to eq(%w(id)) end @@ -30,9 +34,9 @@ describe IgnorableColumn do end it 'returns the names of the ignored columns' do - model.ignore_column(:title) + model.ignore_column(:title, :date) - expect(model.ignored_columns).to eq(Set.new(%w(title))) + expect(model.ignored_columns).to eq(Set.new(%w(title date))) end end end |