Skip to content

Commit 5a4a8ce

Browse files
authored
Make tests that use mock_column more accurate (#48)
Columns that ActiveRecord gives us has String `#names`. Some tests pass in a Symbol name into `mock_column` which is not accurate, so this PR corrects that. Follows up on: #44 (comment)
1 parent 3aed027 commit 5a4a8ce

File tree

5 files changed

+113
-113
lines changed

5 files changed

+113
-113
lines changed

spec/lib/annotate_rb/annotate_models/annotate_models_annotating_a_file_frozen_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ class User < ActiveRecord::Base
1212
@klass = mock_class(:users,
1313
:id,
1414
[
15-
mock_column(:id, :integer),
16-
mock_column(:name, :string, limit: 50)
15+
mock_column("id", :integer),
16+
mock_column("name", :string, limit: 50)
1717
])
1818
@schema_info = AnnotateRb::ModelAnnotator::AnnotationBuilder.new(@klass).build
1919
end
@@ -28,7 +28,7 @@ class User < ActiveRecord::Base
2828
annotate_one_file
2929

3030
another_schema_info = AnnotateRb::ModelAnnotator::AnnotationBuilder.new(
31-
mock_class(:users, :id, [mock_column(:id, :integer)])
31+
mock_class(:users, :id, [mock_column("id", :integer)])
3232
).build
3333

3434
@schema_info = another_schema_info

spec/lib/annotate_rb/annotate_models/annotate_models_annotating_a_file_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class User < ActiveRecord::Base
1313
@klass = mock_class(:users,
1414
:id,
1515
[
16-
mock_column(:id, :integer),
17-
mock_column(:name, :string, limit: 50)
16+
mock_column("id", :integer),
17+
mock_column("name", :string, limit: 50)
1818
])
1919
@schema_info = AnnotateRb::ModelAnnotator::AnnotationBuilder.new(@klass).build
2020
end
@@ -102,8 +102,8 @@ class User < ActiveRecord::Base
102102
klass = mock_class(:users,
103103
:id,
104104
[
105-
mock_column(:id, :integer),
106-
mock_column(:foreign_thing_id, :integer)
105+
mock_column("id", :integer),
106+
mock_column("foreign_thing_id", :integer)
107107
],
108108
[],
109109
[
@@ -124,8 +124,8 @@ class User < ActiveRecord::Base
124124
klass = mock_class(:users,
125125
:id,
126126
[
127-
mock_column(:id, :integer),
128-
mock_column(:foreign_thing_id, :integer)
127+
mock_column("id", :integer),
128+
mock_column("foreign_thing_id", :integer)
129129
],
130130
[],
131131
[
@@ -149,7 +149,7 @@ class User < ActiveRecord::Base
149149
before do
150150
annotate_one_file position: :before
151151
another_schema_info = AnnotateRb::ModelAnnotator::AnnotationBuilder.new(
152-
mock_class(:users, :id, [mock_column(:id, :integer)])
152+
mock_class(:users, :id, [mock_column("id", :integer)])
153153
).build
154154

155155
@schema_info = another_schema_info
@@ -175,7 +175,7 @@ class User < ActiveRecord::Base
175175
before do
176176
annotate_one_file position: :after
177177
another_schema_info = AnnotateRb::ModelAnnotator::AnnotationBuilder.new(
178-
mock_class(:users, :id, [mock_column(:id, :integer)])
178+
mock_class(:users, :id, [mock_column("id", :integer)])
179179
).build
180180

181181
@schema_info = another_schema_info
@@ -214,8 +214,8 @@ class Foo::User < ActiveRecord::Base
214214
klass = mock_class(:foo_users,
215215
:id,
216216
[
217-
mock_column(:id, :integer),
218-
mock_column(:name, :string, limit: 50)
217+
mock_column("id", :integer),
218+
mock_column("name", :string, limit: 50)
219219
])
220220
schema_info = AnnotateRb::ModelAnnotator::AnnotationBuilder.new(
221221
klass

0 commit comments

Comments
 (0)