Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevelito committed Feb 7, 2025
1 parent 6c17503 commit f9e388d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion spec/features/avo/generators/resource_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

context "when generating resources with polymorphic associations" do
it "generates commented polymorphic fields" do
# Create new model and table
ActiveRecord::Schema.define do
create_table :test_comments, force: true do |t|
t.string :commentable_type
Expand All @@ -73,10 +74,12 @@
Rails::Generators.invoke("avo:resource", ["test_comment", "--quiet", "--skip"], {destination_root: Rails.root})

generated_content = File.read(files[0])
expect(generated_content).to include("field :commentable, as: :belongs_to, polymorphic_as: :commentable")
expect(generated_content).to include("# field :commentable, as: :belongs_to, polymorphic_as: :commentable")

# Delete test table and cleanup
Object.send(:remove_const, :TestComment)
ActiveRecord::Base.connection.drop_table(:test_comments)

check_files_and_clean_up files
end
end
Expand Down

0 comments on commit f9e388d

Please sign in to comment.