Skip to content

Commit

Permalink
feat: Add rubric urls to LARA publishing [PT-187946772]
Browse files Browse the repository at this point in the history
  • Loading branch information
dougmartin committed Aug 6, 2024
1 parent 97a4bf3 commit 1ea1050
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def create
:thumbnail_url => params[:thumbnail_url],
:author_email => params[:author_email],
:is_locked => params[:is_locked],
:student_report_enabled => params[:student_report_enabled]
:student_report_enabled => params[:student_report_enabled],
:rubric_url => params[:rubric_url],
:rubric_doc_url => params[:rubric_doc_url]
)

if params[:external_report_url]
Expand Down Expand Up @@ -84,7 +86,7 @@ def update_by_url
external_activity = ExternalActivity.where(url: params[:url]).first
authorize external_activity

permitted_params = params.permit(:name, :student_report_enabled, :thumbnail_url, :is_locked, :append_auth_token, :save_path, :publication_status)
permitted_params = params.permit(:name, :student_report_enabled, :thumbnail_url, :is_locked, :append_auth_token, :save_path, :publication_status, :rubric_url, :rubric_doc_url)

if external_activity.update(permitted_params)
render :json => { success: true }, :status => :ok
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
let(:manager_user) { FactoryBot.generate(:manager_user) }
let(:researcher_user) { FactoryBot.generate(:researcher_user) }
let(:author_user) { FactoryBot.generate(:author_user) }
let(:rubric_url) { "https://example.com/rubric" }
let(:rubric_doc_url) { "https://example.com/rubric_doc" }

describe "#create" do
context "with a guest" do
Expand Down Expand Up @@ -98,6 +100,14 @@
post :create, params: { :name => "test", :url => "http://example.com/", :type => "Activity" }
expect(response.status).to eql(201)
end

it "succeeds with rubric parameters" do
post :create, params: { :name => "test", :url => "http://example.com/", :type => "Activity", :rubric_url => rubric_url, :rubric_doc_url => rubric_doc_url}
expect(response.status).to eql(201)
created_activity = ExternalActivity.last
expect(created_activity.rubric_url).to eql(rubric_url)
expect(created_activity.rubric_doc_url).to eql(rubric_doc_url)
end
end
end

Expand Down Expand Up @@ -208,14 +218,22 @@
expect(response.status).to eql(403)
end

it "should update an activity they did author" do
it "should update an activity they did author (with rubric parameters)" do
my_url = "http://activity.com/activity/2"
post :create, params: { :name => "My Cool Activity", :url => my_url, :type => "Activity" }
created_activity = ExternalActivity.last
expect(created_activity.rubric_url).to eql(nil)
expect(created_activity.rubric_doc_url).to eql(nil)
my_valid_parameters = {
url: my_url
url: my_url,
rubric_url: rubric_url,
rubric_doc_url: rubric_doc_url
}
post :update_by_url, params: my_valid_parameters
expect(response.body).to eql('{"success":true}')
created_activity.reload
expect(created_activity.rubric_url).to eql(rubric_url)
expect(created_activity.rubric_doc_url).to eql(rubric_doc_url)
end
end

Expand Down

0 comments on commit 1ea1050

Please sign in to comment.