Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Small changes in scaffold controller template #718

wants to merge 1 commit into from

3 participants


Change some scaffold controller template methods to let context


I don't use the scaffolded tests at all, but I think this looks reasonable. @dchelimsky, do you have any thoughts?


The RDoc references "this method" - that should probably change to reflect "the value returned by the method generated by this let declaration" or some such. Otherwise, the change seems sound.

@alindeman alindeman closed this pull request from a commit
@alindeman alindeman Adjust wording of comment
[Closes #718]
@alindeman alindeman closed this in 2b9d599
@alindeman alindeman referenced this pull request from a commit
@alindeman alindeman Adjust wording of comment
[Closes #718]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 6 deletions.
  1. +2 −6 lib/generators/rspec/scaffold/templates/controller_spec.rb
8 lib/generators/rspec/scaffold/templates/controller_spec.rb
@@ -24,16 +24,12 @@
# This should return the minimal set of attributes required to create a valid
# <%= class_name %>. As you add validations to <%= class_name %>, be sure to
# update the return value of this method accordingly.
- def valid_attributes
- <%= formatted_hash(example_valid_attributes) %>
- end
+ let(:valid_attributes) { <%= formatted_hash(example_valid_attributes) %> }
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
# <%= controller_class_name %>Controller. Be sure to keep this updated too.
- def valid_session
- {}
- end
+ let(:valid_session) { {} }
<% unless options[:singleton] -%>
describe "GET index" do
Something went wrong with that request. Please try again.