New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to add testing #1712
Comments
I'm not sure if there's a more official way, but you can edit the .components file in the project to set the testing framework (bacon, shoulda, cucumber, riot, rspec, minitest, steak). Example:
Then you can run the generators and the test files should be created for you from then on. |
thanks. I'll try that. Any advice for already existing models? Can I generate just the tests? |
Re-running the generate command for the models will create the test files. |
Padrino provides the component generator, so please try this. Padrino does not provide the way for already existing model. # scripts/sample.rb
require 'padrino-gen/generators/components/tests/rspec' #<-- your test component name
def generate_model_test(name)
rspec_contents = RSPEC_MODEL_TEST.gsub(/!NAME!/, name.to_s.underscore.camelize).gsub(/!DNAME!/, name.to_s.underscore)
model_spec_path = File.join('spec','app','models',"#{name.to_s.underscore}_spec.rb")
create_file model_spec_path, rspec_contents, :skip => true
end
generate_model_test(:model_name) and @padrino/core-members I think the model generator should provide |
Oops, sorry, I was thinking of the controller generator which does allow it. |
@Skeyelab The :force option will be resolved your problem. |
I created a project without a testing framework. What is the best way to add testing now?
The text was updated successfully, but these errors were encountered: