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

feat: Add rubric urls to LARA publishing [PT-187946772] #1350

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading