Comments (5)
@newstler, wondering if you have any suggestions on how we can handle this better.
from bullet_train.
After poking around at this for a while I found that I could get the test to pass by updating test/factories/weidgets.rb
.
It started like this:
FactoryBot.define do
factory :widget do
association :team
name { "MyString" }
end
end
And once I did this, the test started passing:
FactoryBot.define do
factory :widget do
association :team
name { "MyString" }
factory :widget_example do
id { 42 }
team { FactoryBot.example(:team) }
end
end
end
I think we either need to update the scaffolding process to automatically add the _example
factory OR we need to figure out some other way to prevent scaffolding for instantly causing test failures that don't provide any useful info about what's wrong.
from bullet_train.
An example factory like this also works:
factory :widget_example do
id { 42 }
team_id { 42 }
end
(Hard coding a team_id
instead of using FactoryBot.example
to create an example team.
from bullet_train.
After looking at this some more I think maybe our test is just overly fragile. The "failures" are actually just letting you know about warnings issued by redocly. I'm not sure we should fail the tests just due to warnings.
These are the lines causing the problem:
bullet_train/test/controllers/api/open_api_controller_test.rb
Lines 18 to 20 in e26545d
I'm currently thinking that we shouldn't lump together warnings and failures from redocly and treat them all as failures. Instead I think that we should separate them and only treat redocly failures as failures. And then just output a message if there are warnings.
Maybe something like:
failures = output.match("Failed to parse api definition")
puts output if failures
refute failures
warnings = output.match(/You have (\d+) warnings/)
if warnings
puts "-----------------".yellow
puts warnings.yellow
puts "-----------------".yellow
end
@newstler do you see any problems with doing something like this?
from bullet_train.
Hey, I’m sorry I haven’t seen that due to absence of notifications on GitHub some why.
You’re right saying that the solution would be to update the scaffolding process to automatically add the _example
factory.
I wouldn't change the test itself though, as redocly's warnings are basically OpenAPI errors, meaning the documentation is noncompliant.
from bullet_train.
Related Issues (20)
- undefined method 'owning_association' HOT 1
- undefined method `underscore' for nil
- Super scaffolding makes some incorrect assumptions about naming HOT 2
- Join model scaffolder throws an error if you don't supply class names
- Indentation in scaffolded tests is wrong
- Including Sentry in `app.json` breaks review apps on heroku
- Some of the `bin/configure` stuff would be better in `bin/setup` HOT 1
- A fresh app instantly runs out of memory on heroku
- We shoud activate jemalloc by default on heroku
- Can you super scaffold something that doesn't belong to a team? HOT 1
- Running super_scaffold breaks with error message "Model file not found" even though it was generated
- Should we consider switching to Playwright instead of Selenium for driving system tests?
- Unmet dependencies HOT 4
- Problems with `overmind` + `asdf`? HOT 1
- Redirect loop if a team has no members
- Docs for MFA seem to be incomplete HOT 1
- `devise-two-factor` is broken without jQuery
- Support for passkeys?
- Webhook attempt numbers aren't displayed properly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bullet_train.