Skip to content
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

Assessments: Set up basic controller tests #23036

Merged
merged 2 commits into from Jun 12, 2018

Conversation

caleybrock
Copy link
Contributor

Early version of controller tests for assessments. This only includes authentication tests. I wanted to set these up before I start moving some logic out of the controllers and into the models.

test 'verified teacher can get assessment questions and answers' do
sign_in @teacher
get :index, params: {section_id: @section.id, script_id: 2}
assert_response :success
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would add an assertion here to make sure you get the assessment(s) you expect from the index action

test 'verified teacher can get assessment responses from students' do
sign_in @teacher
get :section_responses, params: {section_id: @section.id, script_id: 2}
assert_response :success
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as comment above - just make sure the correct section responses come back as well

@caleybrock
Copy link
Contributor Author

@madelynkasula updated!

@maddiedierker
Copy link
Contributor

@caleybrock i think having both endpoints return some data would be really useful for these tests. something like this:

test 'returns all sections belonging to teacher' do
sign_in @teacher
get :index
assert_response :success
expected = @teacher.sections.map {|section| section.summarize.with_indifferent_access}
assert_equal expected, returned_json
end

that file and the courses_controller_test.rb have a lot of good examples of this

@caleybrock
Copy link
Contributor Author

I totally agree. The goal is for these to come later, I just wanted to first ensure the authentication is correct first.

@caleybrock caleybrock merged commit 0225985 into staging Jun 12, 2018
@caleybrock caleybrock deleted the assessments-controller-tests branch June 12, 2018 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants