Skip to content

Commit c042fe5

Browse files
committed
Follow-up for #3555
Reuse content column instead of adding a new boolean one, as modifying an old migration doesn't change existing databases
1 parent 8708722 commit c042fe5

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

spec/dummy_app/app/mongoid/comment.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
class Comment
44
include Mongoid::Document
55
field :content, type: String
6-
field :boolean_field, type: Mongoid::Boolean
76
include Mongoid::Timestamps
87
include Taggable
98

spec/dummy_app/db/migrate/20110103205808_create_comments.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ def self.up
66
t.integer :commentable_id
77
t.string :commentable_type
88
t.text :content
9-
t.boolean :boolean_field
109

1110
t.timestamps null: false
1211
end

spec/integration/actions/export_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
'Revenue [Team]', 'Color [Team]', 'Custom field [Team]', 'Main Sponsor [Team]', 'Id [Draft]', 'Created at [Draft]',
8484
'Updated at [Draft]', 'Date [Draft]', 'Round [Draft]', 'Pick [Draft]', 'Overall [Draft]',
8585
'College [Draft]', 'Notes [Draft]', 'Id [Comments]', 'Content [Comments]', 'Created at [Comments]',
86-
'Updated at [Comments]', 'Boolean field [Comments]']
86+
'Updated at [Comments]']
8787
expect(csv.flatten).to include("#{player.name} exported")
8888
expect(csv.flatten).to include(player.team.name)
8989
expect(csv.flatten).to include(player.draft.college)
@@ -115,7 +115,7 @@
115115
select "<comma> ','", from: 'csv_options_generator_col_sep'
116116
click_button 'Export to csv'
117117
csv = CSV.parse page.driver.response.body
118-
expect(csv[0]).to match_array ['Id', 'Commentable', 'Commentable type', 'Content', 'Created at', 'Updated at', 'Boolean field']
118+
expect(csv[0]).to match_array ['Id', 'Commentable', 'Commentable type', 'Content', 'Created at', 'Updated at']
119119
csv[1..].each do |line|
120120
expect(line[csv[0].index('Commentable')]).to eq(player.id.to_s)
121121
expect(line[csv[0].index('Commentable type')]).to eq(player.class.to_s)

spec/integration/fields/boolean_spec.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
RailsAdmin.config FieldTest do
5050
field :comment
5151
end
52+
53+
RailsAdmin.config Comment do
54+
field :content, :boolean
55+
end
5256
end
5357

5458
it 'can be updated', js: true do
@@ -59,7 +63,7 @@
5963
# set the value to false and assert the values
6064
find('.boolean_type label.danger').click
6165
click_button 'Save and edit'
62-
expect(field_test.reload.comment.boolean_field).to be false
66+
expect(field_test.reload.comment.content).to eq '0'
6367
end
6468
end
6569

0 commit comments

Comments
 (0)