source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/password_retrieval_controller_spec.rb | Ruby | mit | 191 | main | 3,218 | describe PasswordRetrievalController do
describe 'password reset' do
it 'create new entry in password_resets table' do
@user = User.new
@user.email = 'example@example.edu'
@user.fullname = 'John Bumgardner'
@user.name = 'ex'
@user.save!
request_params = { user: { email: 'exampl... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/conference_controller_spec.rb | Ruby | mit | 191 | main | 7,399 | describe ConferenceController do
let(:admin) { build(:admin, id: 3) }
let(:super_admin) { build(:superadmin) }
let(:instructor) { build(:instructor, id: 2) }
let(:instructor1) { build(:instructor, id: 2, timezonepref: 'Eastern Time (US & Canada)') }
let(:student1) { build(:student, id: 1, name: :lily) }
let... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/review_mapping_controller_spec.rb | Ruby | mit | 191 | main | 34,348 | require 'rails_helper'
describe ReviewMappingController do
let(:assignment) { double('Assignment', id: 1) }
let(:reviewer) { double('Participant', id: 1, name: 'reviewer') }
let(:review_response_map) do
double('ReviewResponseMap', id: 1, map_id: 1, assignment: assignment,
revie... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/student_view_controller_spec.rb | Ruby | mit | 191 | main | 1,512 | describe StudentViewController do
let(:instructor) { build(:instructor, id: 2) }
let(:student1) { build(:student, id: 30, name: :Amanda) }
# student view is only accessible to instructors, so we will make one
before(:each) do
stub_current_user(instructor, instructor.role.name, instructor.role)
end
des... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/airbrake_exception_errors_controller_tests_spec.rb | Ruby | mit | 191 | main | 5,401 | describe TeamsController do
# Airbrake-1807465099223895248
describe '#delete' do
before(:each) do
user = build(:instructor)
stub_current_user(user, user.role.name, user.role)
# to deal with redirect fallback_location: root_path
request.env['HTTP_REFERER'] = 'www.google.com'
end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/participants_controller_spec.rb | Ruby | mit | 191 | main | 11,552 | describe ParticipantsController do
let(:instructor) { build(:instructor, id: 6) }
let(:student) { build(:student) }
let(:student1) { build_stubbed(:student, id: 1, name: 'student') }
let(:course_participant) { build(:course_participant) }
let(:participant) { build(:participant) }
let(:assignment_node) { bui... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/courses_controller_spec.rb | Ruby | mit | 191 | main | 6,949 | describe CoursesController do
let(:instructor) { build(:instructor, id: 6) }
let(:instructor2) { build(:instructor, id:6666)}
let(:student) { build(:student) }
let(:course) { double('Course', instructor_id: 6, path: '/cscs', name: 'abc') }
describe '#action_allowed?' do
context 'when current user is stude... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/teams_controller_spec.rb | Ruby | mit | 191 | main | 11,890 | require './spec/support/teams_shared.rb'
describe TeamsController do
# Performs authorization check for user
include_context 'object initializations'
describe 'action allowed method' do
context 'provides access after' do
# Including the shared method from the teams_shared.rb file
include_context... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/reports_controller_spec.rb | Ruby | mit | 191 | main | 8,646 | require 'rails_helper'
describe ReportsController do
let(:assignment) { double('Assignment', id: 1) }
let(:review_response_map) do
double('ReviewResponseMap', id: 1, map_id: 1, assignment: assignment,
reviewer: double('Participant', id: 1, name: 'reviewer'), reviewee: double('Par... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/student_teams_controller_spec.rb | Ruby | mit | 191 | main | 8,448 | require './spec/support/teams_shared.rb'
describe StudentTeamsController do
# Including the stubbed objects from the teams_shared.rb file
include_context 'object initializations'
# Including the shared method from the teams_shared.rb file
include_context 'authorization check'
let(:student_teams_controller) ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/pair_programming_controller_spec.rb | Ruby | mit | 191 | main | 4,330 | describe PairProgrammingController do
let(:super_admin) { build(:superadmin, id: 1, role_id: 5) }
let(:admin) { build(:admin, id: 3) }
let(:instructor1) { build(:instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1') }
let(:student1) { build(:student, id: 21, role_id: 1) }
let(:student2) { build(:... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/roles_controller_spec.rb | Ruby | mit | 191 | main | 4,186 | describe RolesController do
let(:super_admin) { build(:superadmin, id: 1, role_id: 5) }
let(:student) { build(:student, id: 1, role_id: 1) }
let(:student_role) { build(:role_of_student, id: 1, name: 'Student_role_test', description: '', parent_id: nil, default_page_id: nil) }
let(:instructor_role) { build(:role... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/advertise_for_partner_controller_spec.rb | Ruby | mit | 191 | main | 9,449 | require './spec/support/teams_shared.rb'
describe AdvertiseForPartnerController do
# Including the stubbed objects from the teams_shared.rb file
include_context 'object initializations'
let(:team1user1) { build_stubbed(:team_user, id: 1, team: team1, user: student1) }
let(:team1user2) { build_stubbed(:team_use... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/duties_controller_spec.rb | Ruby | mit | 191 | main | 5,367 | describe DutiesController do
let(:assignment) { build(:assignment, id: 1, course_id: 1, instructor_id: 6, due_dates: [due_date], microtask: true, staggered_deadline: true) }
let(:admin) { build(:admin) }
let(:instructor) { build(:instructor, id: 6) }
let(:instructor2) { build(:instructor, id: 66) }
let(:ta) {... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/answer_tags_controller_spec.rb | Ruby | mit | 191 | main | 7,972 | describe AnswerTagsController do
# factory objects required for "action_allowed" test cases
let(:instructor) { build(:instructor, id: 1) }
let(:student) { build(:student, id: 1) }
let!(:assignment) { create(:assignment, name: 'assignment', directory_path: 'assignment', id: 1) }
let!(:assignment2) { create(:as... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/admin_controller_spec.rb | Ruby | mit | 191 | main | 7,762 | describe AdminController do
let(:admin1) { build(:admin, id: 3, role_id: 4, parent_id: 1, name: 'Administrator1') }
let(:admin2) { build(:admin, id: 4, role_id: 4, parent_id: 1, name: 'Administrator2') }
let(:super_admin) { build(:superadmin, id: 1, role_id: 5) }
let(:instructor1) { build(:instructor, id: 10, r... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/sample_reviews_controller_spec.rb | Ruby | mit | 191 | main | 4,918 | require 'rails_helper'
RSpec.describe SampleReviewsController, type: :controller do
let(:team) { build(:assignment_team, id: 1, name: 'team no name', assignment: assignment, users: [student], parent_id: 1) }
let(:team1) { build(:assignment_team, id: 2, name: 'team has name', assignment: assignment, users: [student... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/suggestion_controller_spec.rb | Ruby | mit | 191 | main | 4,371 | describe SuggestionController do
let(:assignment) do
build(:assignment, id: 1, name: 'test assignment', instructor_id: 6, staggered_deadline: true, directory_path: 'same path',
participants: [build(:participant)], teams: [build(:assignment_team)], course_id: 1, allow_suggestions: 1)
end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/eula_controller_spec.rb | Ruby | mit | 191 | main | 2,545 | describe EulaController do
let(:instructor) { build(:instructor, id: 6) }
let(:student) { build(:student) }
describe '#action_allowed?' do
context 'when current user is student' do
# first test to make sure student cannot do all actions
it 'allows all actions' do
expect(controller.send(... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/popup_controller_spec.rb | Ruby | mit | 191 | main | 8,906 | describe PopupController do
let(:superadmin) { build_stubbed(:superadmin) }
let(:admin) { build_stubbed(:admin) }
let(:ta) { build_stubbed(:teaching_assistant) }
let(:questionnaire) { build_stubbed(:questionnaire, id: 1, max_question_score: 20) }
let(:question) { build_stubbed(:question, id: 1, questionnaire_... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/users_controller_spec.rb | Ruby | mit | 191 | main | 16,228 | describe UsersController do
let(:admin) { build(:admin, id: 3) }
let(:super_admin) { build(:superadmin) }
let(:instructor) { build(:instructor, id: 2) }
let(:student1) { build(:student, id: 1, name: :lily) }
let(:student2) { build(:student) }
let(:student3) { build(:student, id: 10, role_id: 1, parent_id: n... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/quiz_questionnaires_controller_spec.rb | Ruby | mit | 191 | main | 21,937 | describe QuizQuestionnairesController do
let(:questionnaire) do
build(id: 1, name: 'questionnaire', ta_id: 8, course_id: 1, private: false, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire')
end
let(:questionnaire) { build(:questionnaire) }
let(:quiz_questionnaire) { build(:questionn... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/review_bids_controller_spec.rb | Ruby | mit | 191 | main | 3,149 | describe ReviewBidsController do
# let(:assignment) { double('Assignment', id: 1) }
# let(:participant) { double('AssignmentParticipant', id: 1, can_review: false, user: double('User', id: 1)) }
let(:student) { build(:student, id: 1, name: 'name', fullname: 'no one', email: 'expertiza@mailinator.com') }
let(:as... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/response_controller_spec.rb | Ruby | mit | 191 | main | 18,763 | describe ResponseController do
let(:assignment) { build(:assignment, instructor_id: 6, id: 1) }
let(:instructor) { build(:instructor, id: 6) }
let(:participant) { build(:participant, id: 1, user_id: 6, assignment: assignment) }
let(:review_response) { build(:response, id: 1, map_id: 1) }
let(:review_response_... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/tree_display_controller_spec.rb | Ruby | mit | 191 | main | 12,711 | describe TreeDisplayController do
# Airbrake-1517247902792549741
describe '#list' do
it 'should not redirect if current user is an instructor' do
user = build(:instructor)
stub_current_user(user, user.role.name, user.role)
get 'list'
expect(response).to have_http_status(200)
end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/lottery_controller_spec.rb | Ruby | mit | 191 | main | 7,690 | describe LotteryController do
let(:assignment) { create(:assignment, is_intelligent: true, name: 'assignment', directory_path: 'assignment') }
let(:assignment_2) { create(:assignment, is_intelligent: false, name: 'assignment_2', directory_path: 'assignment_2') }
let(:student1) { create(:student, name: 'student1'... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/questionnaires_controller_spec.rb | Ruby | mit | 191 | main | 23,114 | # frozen_string_literal: true
describe QuestionnairesController do
let(:questionnaire) do
build(id: 1, name: 'questionnaire', ta_id: 8, course_id: 1, private: false, min_question_score: 0, max_question_score: 5, type: 'ReviewQuestionnaire')
end
let(:questionnaire) { build(:questionnaire) }
let(:quiz_questi... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/controllers/helpers/assignment_helper.rb | Ruby | mit | 191 | main | 315 | module AssignmentHelper
def assignment1
Assignment.where(name: 'assignment1').first || Assignment.new('id' => '101',
'name' => 'My assignment',
'is_intelligent' => 1)
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/lib/scoring_spec.rb | Ruby | mit | 191 | main | 18,782 | describe Scoring do
include Scoring
let(:assignment_helper) { Class.new { extend AssignmentHelper } }
let(:questionnaire) { create(:questionnaire, id: 1) }
let(:question1) { create(:question, questionnaire: questionnaire, weight: 1, id: 1) }
let(:response) { build(:response, id: 1, map_id: 1, scores: [answer]... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/lib/hamer_spec.rb | Ruby | mit | 191 | main | 362 | describe Hamer do
include Hamer
describe "#converged?" do
context "when lists a and b are the same size with precision 2" do
it "returns true" do
a = [1.234, 2.35, 3.1415]
b = [1.232, 2.354, 3.1439]
expect(Hamer.converged?(a,b)).to eq(tru... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/workers/sidekiq_mail_worker_spec.rb | Ruby | mit | 191 | main | 2,285 | describe MailWorker do
let(:assignment) { build(:assignment, id: 1, name: 'no assignment', participants: [participant], teams: [team]) }
let(:participant) { build(:participant, id: 1, parent_id: 1, user: user) }
let(:team) { build(:assignment_team, id: 1, name: 'no team', users: [user], parent_id: 1) }
let(:use... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/bookmark_rating_questionnaire_spec.rb | Ruby | mit | 191 | main | 594 | describe BookmarkRatingQuestionnaire do
let(:questionnaire) { build(:bookmark_questionnaire, id: 2) }
let(:participant) { build(:participant, id: 1) }
describe '#symbol' do
it 'returns the symbol for a Bookmark Rating Questionnaire' do
expect(questionnaire.symbol).to eq(:bookmark)
end
end
descri... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/due_date_spec.rb | Ruby | mit | 191 | main | 6,131 | describe 'due_date_functions' do
before(:each) do
@deadline_type = build(:deadline_type)
@deadline_right = build(:deadline_right)
@assignment_due_date = build(:assignment_due_date, deadline_type: @deadline_type,
submission_allowed_id: @deadline_right.... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/bid_spec.rb | Ruby | mit | 191 | main | 1,381 | describe Bid do
let(:assignment) { create(:assignment, is_intelligent: true, name: 'assignment') }
let(:topic1) { create(:topic, assignment_id: assignment.id) }
let(:topic2) { create(:topic, assignment_id: assignment.id) }
let(:topic3) { create(:topic, assignment_id: assignment.id) }
let(:topic4) { create(:t... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/course_survey_response_map_spec.rb | Ruby | mit | 191 | main | 2,799 | describe CourseSurveyResponseMap do
let(:participant) { build(:participant, user_id: 1, user: build(:student, name: 'Jane', fullname: 'Doe, Jane', id: 1)) }
let(:course_survey_questionnaire) { CourseSurveyQuestionnaire.new id: 985, name: 'course_survey', private: 0, min_question_score: 0, max_question_score: 10, in... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/locale_spec.rb | Ruby | mit | 191 | main | 2,220 | describe Locale do
let(:no_pref_locale) { Locale.new(:no_pref, 'No Preference', 0) }
describe '#available_locales' do
it 'finds translations for the mandatory fields (such as display_name and db_encoding) for all available locales' do
expect(Locale.available_locales.to_s).to_not match('translation missin... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/sign_up_topic_spec.rb | Ruby | mit | 191 | main | 10,933 | describe SignUpTopic do
let(:topic) { build(:topic) }
let(:suggestion) { build(:suggestion, id: 1, assignment_id: 1) }
let(:signed_up_team) { build(:signed_up_team) }
let(:team) { create(:assignment_team, id: 1, name: 'team 1', users: [user, user2]) }
let(:user) { create(:student) }
let(:user2) { create(:st... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/role_spec.rb | Ruby | mit | 191 | main | 981 | describe Role do
before :all do
@student_role = build(:role_of_student, id: 1, name: 'Student_role_test', description: '', parent_id: nil, default_page_id: nil)
@instructor_role = build(:role_of_instructor, id: 2, name: 'Instructor_role_test', description: '', parent_id: nil, default_page_id: nil)
@admin_... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/language_spec.rb | Ruby | mit | 191 | main | 266 | describe Language do
describe '#the name of the language' do
it 'is settable and returnable' do
language = Language.new
expect(language.name).to eq(nil)
language.name = 'English'
expect(language.name).to eq('English')
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/authority_spec.rb | Ruby | mit | 191 | main | 1,154 | describe Authority do
let(:user1) { create(:student, name: 'expertizauser', id: 1) }
let(:admin) { build(:admin) }
describe '#initialize' do
it 'sets the current user' do
authority = Authority.new(current_user: user1)
expect(authority.current_user).to be(user1)
end
end
describe 'allow?' d... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/questionnaire_analytic_spec.rb | Ruby | mit | 191 | main | 7,267 | class QuestionnaireAnalyticTestDummyClass
attr_accessor :questions
require 'analytic/questionnaire_analytic'
include QuestionnaireAnalytic
def initialize(questions)
@questions = questions
end
end
describe QuestionnaireAnalytic do
let(:question) { Criterion.new(id: 1, weight: 2, break_before: true) }
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/vm_question_response_row_spec.rb | Ruby | mit | 191 | main | 4,411 | describe VmQuestionResponseRow do
let(:row) { VmQuestionResponseRow.new('Question for testing average score', 1, 1, 5, 1) }
describe '#average_score_for_row' do
it 'returns correct average score for all not nil scores' do
score1 = VmQuestionResponseScoreCell.new(5, '#D98880', 'Case_2_score_value1 = 5')
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/google_doc_fetcher_spec.rb | Ruby | mit | 191 | main | 966 | describe 'GoogleDocFetcher' do
it 'supports any valid URL' do
expect(GoogleDocFetcher.supports_url?('https://drive.google.com/open?id=1Ngds9Fr4vas8n0cA-uvZDOU7VMarMfGytbC9VLc0IYI')).to be_truthy
expect(GoogleDocFetcher.supports_url?('https://docs.google.com/document/d/1-waDJtPB8VGLyubb40-X951PF9R3jdhm6Kb4ga__... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/collusion_cycle_spec.rb | Ruby | mit | 191 | main | 19,228 | # Removed failing test cases regarding the reviews_by_reviewer method in assignment_participant, which was removed because it was unused elsewhere in the application.
# Committed by lburgess07 on 10/14/2020 hash: 76d145836
describe CollusionCycle do
#
# assignment participant -----
# ^ |
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/user_spec.rb | Ruby | mit | 191 | main | 18,415 | describe User do
let(:user) do
User.new name: 'abc', fullname: 'abc xyz', email: 'abcxyz@gmail.com', password: '12345678', password_confirmation: '12345678',
email_on_submission: 1, email_on_review: 1, email_on_review_of_review: 0, copy_of_emails: 1, handle: 'handle'
end
let(:user1) { User.new na... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/review_comment_paste_bin_spec.rb | Ruby | mit | 191 | main | 258 | describe ReviewCommentPasteBin do
it { should belong_to(:review_grade) }
describe 'instance variables' do
it 'it can be set' do
rcpb = ReviewCommentPasteBin.new
rcpb.title = 'title'
rcpb.review_comment = 'comment'
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/dropdown_spec.rb | Ruby | mit | 191 | main | 2,078 | describe Dropdown do
let(:dropdown) { build(:dropdown, id: 1) }
let(:questionnaire) { create(:questionnaire, id: 1) }
let(:question1) { create(:question, questionnaire: questionnaire, weight: 1, id: 1, type: 'Criterion') }
let(:response_map) { create(:review_response_map, id: 1, reviewed_object_id: 1) }
let!(... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/answer_spec.rb | Ruby | mit | 191 | main | 2,687 | describe Answer do
let(:questionnaire) { create(:questionnaire, id: 1) }
let(:question1) { create(:question, questionnaire: questionnaire, weight: 1, id: 1) }
let(:question2) { create(:question, questionnaire: questionnaire, weight: 2, id: 2) }
let(:response_map) { create(:review_response_map, id: 1, reviewed_o... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/text_field_spec.rb | Ruby | mit | 191 | main | 1,540 | describe TextField do
let!(:answer) { create(:answer, comments: 'test comment') }
describe '#complete' do
it 'returns html' do
tf = TextField.new
tf.txt = 'Field Text'
tf.size = 35
html = tf.complete(1, answer)
expect(html).to eq('<p style="width: 80%;"><label for="responses_1" >Fi... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/assignment_form_spec.rb | Ruby | mit | 191 | main | 52,740 | describe AssignmentForm do
let(:assignment) { build(:assignment, id: 1) }
let(:due_date) { build(:assignment_due_date) }
let(:assignment_form) { AssignmentForm.new }
let(:user) { double('Instructor', timezonepref: 'Eastern Time (US & Canada)') }
let(:assignment_questionnaire1) { build(:assignment_questionnair... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/question_advice_spec.rb | Ruby | mit | 191 | main | 969 | describe QuestionAdvice do
let(:questionnaire) { Questionnaire.new id: 1, name: 'abc', private: 0, min_question_score: 0, max_question_score: 10, instructor_id: 1234 }
let(:question) { build(:question, id: 1) }
let(:question_advice) { build(:question_advice) }
describe 'has correct csv values?' do
before(:e... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/permission_spec.rb | Ruby | mit | 191 | main | 505 | describe Permission do
it { should have_many(:content_pages) }
it { should have_many(:controller_actions) }
it 'should have a name' do
perm = Permission.new
expect(perm).not_to be_valid
end
it 'should have a valid name' do
perm = Permission.new(name: 'TestPermission')
expect(perm).to be_vali... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/team_spec.rb | Ruby | mit | 191 | main | 16,822 | describe Team do
let(:assignment) { build(:assignment, id: 1, name: 'no assgt') }
let(:participant) { build(:participant, user_id: 1) }
let(:participant2) { build(:participant, user_id: 2) }
let(:participant3) { build(:participant, user_id: 3) }
let(:user) { build(:student, id: 1, name: 'no name', fullname: '... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/vm_user_answer_tagging_spec.rb | Ruby | mit | 191 | main | 735 | describe VmUserAnswerTagging do
let(:user1) { User.new name: 'abc', fullname: 'abc bbc', email: 'abcbbc@gmail.com', password: '123456789', password_confirmation: '123456789' }
describe '#initialize' do
it 'sets the instance variables' do
vm_user_answer_tagging = VmUserAnswerTagging.new(user1, 75, true, tr... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/questionnaire_spec.rb | Ruby | mit | 191 | main | 6,120 | describe Questionnaire do
let(:questionnaire) { Questionnaire.new name: 'abc', private: 0, min_question_score: 0, max_question_score: 10, instructor_id: 1234 }
let(:questionnaire1) { Questionnaire.new name: 'xyz', private: 0, max_question_score: 20, instructor_id: 1234 }
let(:assignment) { build(:assignment, id: ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/assignment_survey_response_map_spec.rb | Ruby | mit | 191 | main | 2,890 | describe AssignmentSurveyResponseMap, type: :model do
let(:participant) { build(:participant, user_id: 1, user: build(:student, name: 'Jane', fullname: 'Doe, Jane', id: 1)) }
let(:assignment_questionnaire1) { build(:assignment_questionnaire, id: 1, assignment_id: 1, questionnaire_id: 1) }
let(:previous_day) { (Ti... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/answer_tag_spec.rb | Ruby | mit | 191 | main | 2,065 | require 'rails_helper'
describe AnswerTag do
let(:questionnaire) { create(:questionnaire, id: 1) }
let(:question1) { create(:question, questionnaire: questionnaire, weight: 1, id: 1, type: 'Criterion') }
let(:response_map) { create(:review_response_map, id: 1, reviewed_object_id: 1) }
let!(:response_record) { ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/metareview_response_map_spec.rb | Ruby | mit | 191 | main | 9,909 | describe MetareviewResponseMap do
let(:team) { build(:assignment_team, id: 1, name: 'team no name', assignment: assignment, users: [student], parent_id: 1) }
let(:team2) { build(:assignment_team, id: 3, name: 'no team') }
let(:team1) { build(:assignment_team, id: 2, name: 'team has name', assignment: assignment, ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/lock_spec.rb | Ruby | mit | 191 | main | 4,547 | # This test was added for E1973:
# http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_Project_E1973._Team_Based_Reviewing
# For this project, it was only necessary that responses be locked. If you plan on using Lock for another model,
# You should add cases for that model to this test.
describe Lock do
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/vm_tag_prompt_answer_spec.rb | Ruby | mit | 191 | main | 657 | describe VmTagPromptAnswer do
let!(:answer) { create(:answer, comments: 'test comment') }
let(:tp) { TagPrompt.new(prompt: 'test prompt', desc: 'test desc', control_type: 'Checkbox') }
let(:tag_dep) { TagPromptDeployment.new id: 1, tag_prompt: tp, tag_prompt_id: 1, question_type: 'Criterion', answer_length_thresh... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/airbrake_expection_errors_unit_tests_spec.rb | Ruby | mit | 191 | main | 4,435 | describe 'Airbrake-1781551925379466692' do
let(:assignment) { build(:assignment, id: 1) }
let(:assignment_questionaire1) { build(:assignment_questionaire1, assignment_id: 1, used_in_round: 2) }
let(:assignment_due_date) do
build(:assignment_due_date, parent_id: 1, due_at: '2011-11-11 11:11:11 UTC', deadline_n... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/questionnaire_header_spec.rb | Ruby | mit | 191 | main | 522 | describe QuestionnaireHeader do
let(:questionnaire_header) { build(:questionnaire_header) }
describe '#view_question_text' do
it 'returns the html' do
expect(questionnaire_header.view_question_text).to eq('<TR><TD align="left"> Test question: </TD><TD align="left">QuestionnaireHeader</TD><td align="center... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/cake_spec.rb | Ruby | mit | 191 | main | 6,791 | describe 'cake' do
let(:questionnaire) { Questionnaire.new min_question_score: 0, max_question_score: 5 }
let(:cake) { Cake.new id: 1, type: 'Cake', seq: 1.0, txt: 'Cake type question?', weight: 1, questionnaire: questionnaire, size: '50' }
let(:answer) { Answer.new answer: 45 }
let(:answer1) { Answer.new answe... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/github_pull_request_fetcher_spec.rb | Ruby | mit | 191 | main | 816 | describe 'GithubPullRequestFetcher' do
it 'supports any valid URL' do
expect(GithubPullRequestFetcher.supports_url?('https://github.com/totallybradical/simicheck-expertiza-sandbox/pull/3')).to be_truthy
end
it 'fetches a pull request diff' do
http_setup_get_request_mock_success
params = { 'url' => '... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/website_fetcher_spec.rb | Ruby | mit | 191 | main | 781 | describe 'WebsiteFetcher' do
it 'supports any valid URL' do
expect(WebsiteFetcher.supports_url?('http://www.google.com')).to be_truthy
expect(WebsiteFetcher.supports_url?('https://github.com/totallybradical/expertiza-simicheck-integration')).to be_truthy
end
it 'fetches a website and removes all HTML' do... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/waitlist_spec.rb | Ruby | mit | 191 | main | 1,743 | describe Waitlist do
let(:topic1) { build(:topic, id: 1) }
let(:topic2) { build(:topic, id: 2) }
let(:signedupteam1) { build(:signed_up_team) }
let(:signedupteam2) { build(:signed_up_team) }
let(:signedupteam3) { build(:signed_up_team, is_waitlisted: false) }
let(:signedupteam4) { build(:signed_up_team, is_... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/course_team_spec.rb | Ruby | mit | 191 | main | 3,782 | describe 'CourseTeam' do
let(:course_team1) { build(:course_team, id: 1, name: 'no team') }
let(:user2) { build(:student, id: 2, name: 'no name') }
let(:participant) { build(:participant, user: user2) }
let(:course) { build(:course, id: 1, name: 'ECE517') }
let(:team_user) { build(:team_user, id: 1, user: use... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/bookmark_spec.rb | Ruby | mit | 191 | main | 912 | describe Bookmark do
bookmark = nil
before(:each) do
bookmark = build(:bookmark, url: 'http://example.com', title: 'Test Bookmark', description: 'test description')
end
describe '#url' do
it 'should not be blank' do
bookmark.url = ''
expect(bookmark).not_to be_valid
end
it 'should... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/review_response_map_spec.rb | Ruby | mit | 191 | main | 18,336 | describe ReviewResponseMap do
let(:team) { build(:assignment_team, id: 1, name: 'team no name', assignment: assignment, users: [student], parent_id: 1) }
let(:team2) { build(:assignment_team, id: 3, name: 'no team') }
let(:team1) { build(:assignment_team, id: 2, name: 'team has name', assignment: assignment, user... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/assignment_participant_spec.rb | Ruby | mit | 191 | main | 14,244 | describe AssignmentParticipant do
let(:response) { build(:response) }
let(:team) { build(:assignment_team, id: 1) }
let(:team2) { build(:assignment_team, id: 2) }
let(:response_map) { build(:review_response_map, reviewer_id: 2, response: [response]) }
let(:participant) { build(:participant, id: 1, assignment:... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/awarded_badge_spec.rb | Ruby | mit | 191 | main | 555 | describe AwardedBadge do
let(:awarded_badge) { build(:awarded_badge) }
describe '#approved?' do
context 'when the badge has been approved' do
it 'returns true' do
allow(awarded_badge).to receive(:approval_status).and_return(1)
expect(awarded_badge.approved?).to be_truthy
end
end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/quiz_questionnaire_spec.rb | Ruby | mit | 191 | main | 2,229 | describe QuizQuestionnaire do
let(:quiz_questionnaire) { QuizQuestionnaire.new }
let(:quiz_response_map) { build(:quiz_response_map) }
let(:participant) { build(:participant, id: 1, assignment: assignment) }
let(:response) { build(:response) }
let(:assignment) { build(:assignment, id: 1) }
describe '#symbol... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/institution_spec.rb | Ruby | mit | 191 | main | 279 | describe Institution do
subject do
described_class.new(name: 'NC State University')
end
it 'is valid with valid a name' do
expect(subject).to be_valid
end
it 'is not valid without a name' do
subject.name = nil
expect(subject).to_not be_valid
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/bookmark_rating_response_map_spec.rb | Ruby | mit | 191 | main | 1,556 | describe BookmarkRatingResponseMap do
let(:assignment) { build(:assignment, id: 1, name: 'no assgt') }
let(:questionnaire1) { build(:questionnaire, id: 1, type: 'MetareviewQuestionnaire') }
let(:questionnaire2) { build(:questionnaire, id: 2, type: 'BookmarkRatingQuestionnaire') }
let(:model) { BookmarkRatingRes... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/signed_up_team_spec.rb | Ruby | mit | 191 | main | 3,620 | describe SignUpTopic do
let(:topic_id) { 1 } # Define topic_id with a suitable value
let(:team_id) { 2 } # Define team_id with a suitable value
let(:topic) { build(:topic) }
let(:team) { create(:assignment_team, id: 1, name: 'team 1', users: [user, user2]) }
let(:user) { create(:student) }
let(:user2) { cr... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/bookmark_rating_spec.rb | Ruby | mit | 191 | main | 612 | describe BookmarkRating do
let(:user1) { create(:student, name: 'expertizauser', id: 1) }
bookmark1 = nil
before(:each) do
bookmark1 = build(:bookmark, url: 'http://example.com', title: 'Test Bookmark', description: 'test description')
end
it 'can have a user and a bookmark' do
bookmark_rating = Boo... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/sign_up_sheet_spec.rb | Ruby | mit | 191 | main | 2,683 | describe SignUpSheet do
describe '.add_signup_topic' do
it 'will return an empty Hash when there are no topics' do
assignment = double('Assignment')
allow(assignment).to receive(:num_review_rounds) { nil }
allow(Assignment).to receive(:find) { assignment }
allow(SignUpTopic).to receive(:w... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/scale_spec.rb | Ruby | mit | 191 | main | 3,134 | describe 'scale' do
let(:questionnaire) { Questionnaire.new min_question_score: 0, max_question_score: 5 }
let(:scale) { Scale.new id: 1, type: 'Scale', seq: 1.0, txt: 'test txt', weight: 1, questionnaire: questionnaire }
let(:answer) { Answer.new answer: 8 }
describe '#edit' do
it 'returns the html ' do
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/assignment_team_spec.rb | Ruby | mit | 191 | main | 15,319 | describe 'AssignmentTeam' do
let(:team_without_submitted_hyperlinks) { build(:assignment_team, submitted_hyperlinks: '') }
let(:team) { build(:assignment_team, id: 1, parent_id: 1) }
let(:assignment) { build(:assignment, id: 1) }
let(:participant1) { build(:participant, id: 1) }
let(:participant2) { build(:pa... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/section_header_spec.rb | Ruby | mit | 191 | main | 521 | describe SectionHeader do
let(:section_header) { build(:section_header) }
describe '#complete' do
it 'returns html' do
html = section_header.complete(1)
expect(html).to eq('<b style="color: #986633; font-size: x-large">Test question:</b><br/><br/>')
end
end
describe '#view_completed_question... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/student_task_spec.rb | Ruby | mit | 191 | main | 16,884 | describe StudentTask do
# Write your mocked object here!
let(:participant) { build(:participant, id: 1, user_id: user.id, parent_id: assignment.id) }
let(:participant2) { build(:participant, id: 2, user_id: user2.id, parent_id: assignment.id) }
let(:user) { create(:student) }
let(:user2) { create(:student, na... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/quiz_response_map_spec.rb | Ruby | mit | 191 | main | 2,273 | describe QuizResponseMap do
let(:quiz_questionnaire) { QuizQuestionnaire.new }
let(:team) { build(:assignment_team, id: 1, parent_id: 1) }
let(:quiz_response_map) { build(:quiz_response_map, quiz_questionnaire: quiz_questionnaire, reviewee_id: 1) }
let(:participant) { build(:participant, id: 1, assignment: assi... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/submission_content_fetcher_spec.rb | Ruby | mit | 191 | main | 1,704 | describe 'SubmissionContentFetcher' do
it 'cannot be instantiated' do
expect { SubmissionContentFetcher.new }.to raise_error(NoMethodError)
end
it 'creates factory for wiki documentation' do
url = 'http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Spring_2016/E1738_Integrate_Simicheck_Web_Service'
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/duty_spec.rb | Ruby | mit | 191 | main | 2,353 | describe Duty do
let(:assignment) { build(:assignment, id: 1, name: 'no assgt') }
let(:participant) { build(:participant, id: 1, user_id: 1) }
let(:participant2) { build(:participant, id: 2, user_id: 2) }
let(:participant3) { build(:participant, id: 3, user_id: 3) }
let(:user) { build(:student, id: 1, name: '... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/question_analytic_spec.rb | Ruby | mit | 191 | main | 1,248 | class QuestionAnalyticTestDummyClass
attr_accessor :txt
require 'analytic/question_analytic'
include QuestionAnalytic
def initialize(txt)
@txt = txt
end
def uni_character_count
unique_character_count
end
def char_count
character_count
end
def wc
word_count
end
end
describe ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/markup_style_spec.rb | Ruby | mit | 191 | main | 375 | describe MarkupStyle do
it 'is invalid without valid attributes' do
expect(MarkupStyle.new).not_to be_valid
end
it 'is valid with valid attributes' do
expect(MarkupStyle.new(name: 'Header for Question')).to be_valid
end
it 'can access name' do
ms = MarkupStyle.new(name: 'Header for Question')
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/quiz_question_spec.rb | Ruby | mit | 191 | main | 1,676 | describe QuizQuestion do
let(:quiz_question) { QuizQuestion.new }
let(:quiz_question_choice1) { QuizQuestionChoice.new }
let(:quiz_question_choice2) { QuizQuestionChoice.new }
let(:quiz_question_choice3) { QuizQuestionChoice.new }
let(:quiz_question_choice4) { QuizQuestionChoice.new }
before(:each) do
q... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/course_analytic_spec.rb | Ruby | mit | 191 | main | 15,012 | class CourseAnalyticTestDummyClass
attr_accessor :course, :participants, :assignments
require 'analytic/course_analytic'
include CourseAnalytic
def initialize(course, participants, assignments)
@course = course
@participants = participants
@assignments = assignments
end
end
describe CourseAnalyt... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/multiple_choice_checkbox_spec.rb | Ruby | mit | 191 | main | 8,188 | describe MultipleChoiceCheckbox do
let(:multiple_choice_checkbox) { build(:multiple_choice_checkbox, id: 1) }
let(:questionnaire1) { build(:questionnaire, id: 1, type: 'ReviewQuestionnaire') }
let(:questionnaire2) { build(:questionnaire, id: 2, type: 'MetareviewQuestionnaire') }
let(:team) { build(:assignment_t... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/http_request_spec.rb | Ruby | mit | 191 | main | 843 | describe 'HttpRequest' do
it 'cannot be instantiated' do
expect { HttpRequest.new }.to raise_error(NoMethodError)
end
it 'correctly identifies URLs' do
expect(HttpRequest.valid_url?('http://www.google.com')).to be_truthy
expect(HttpRequest.valid_url?('https://www.google.com')).to be_truthy
expect... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/menu_item_spec.rb | Ruby | mit | 191 | main | 7,028 | describe MenuItem do
###
# Use factories to `build` necessary objects.
# Please avoid duplicated code as much as you can by moving the code to `before(:each)` block or separated methods.
# RSpec tutorial video (until 9:32): https://youtu.be/dzkVfaKChSU?t=35s
# RSpec unit tests examples: https://github.com/exp... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/tag_prompt_spec.rb | Ruby | mit | 191 | main | 2,726 | require 'rails_helper'
describe TagPrompt do
let(:ct_criterion) { Criterion.new id: 1, type: 'Criterion', seq: 1.0, txt: 'test txt', weight: 1 }
let(:ct_cbox) { Checkbox.new id: 1, type: 'Checkbox', seq: 1.0, txt: 'test txt', weight: 1 }
let(:ct_text) { TextArea.new id: 1, type: 'TextArea', seq: 1.0, txt: 'test ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/credentials_spec.rb | Ruby | mit | 191 | main | 385 | describe Credentials do
let(:role) { build(:role_of_student) }
describe '#initialize' do
it 'sets instance variables' do
cred = Credentials.new(1)
allow(Role).to receive(:find).with(1).and_return(role)
allow(role).to receive(:get_parents).and_return(:role)
allow(role).to receive(:id).and... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/text_area_spec.rb | Ruby | mit | 191 | main | 1,404 | describe TextArea do
let(:text_area) { create(:text_area) }
let!(:answer) { create(:answer, comments: 'test comment') }
describe '#complete' do
context 'when the size is nil' do
it 'uses a default size and returns html' do
allow(text_area).to receive(:size).and_return(nil)
html = text_ar... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/menu_spec.rb | Ruby | mit | 191 | main | 9,361 | describe Node do
let(:node) { Menu::Node.new }
let(:content_page) { double('ContentPage', id: 1, name: 'name') }
let(:controller_action) { double('ControllerAction', id: 99, name: 'name', url_to_use: 'url', controller: nil) }
let(:controller) { double('Controller', id: 3, name: 'name') }
let(:menu_item) do
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/submission_record_spec.rb | Ruby | mit | 191 | main | 626 | # These rpec will test the validity of the SubmissionRecord model. It tests for
# valid team_id, operation, user, assignment id.
describe SubmissionRecord do
it 'is invalid without a team id' do
expect(build(:submission_record, team_id: nil)).to_not be_valid
end
it 'is invalid without an operation' do
exp... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/course_node_spec.rb | Ruby | mit | 191 | main | 3,652 | describe CourseNode do
let(:course) { build(:course, id: 1, name: 'ECE517') }
let(:course_node) { build(:course_node, id: 1) }
let(:user1) { User.new name: 'abc', fullname: 'abc bbc', email: 'abcbbc@gmail.com', password: '123456789', password_confirmation: '123456789' }
let(:assignment) { build(:assignment, id:... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/true_false_spec.rb | Ruby | mit | 191 | main | 2,537 | describe TrueFalse do
let(:true_false) { build(:true_false, id: 1) }
describe '#edit' do
it 'returns html' do
qc1 = double('QuizQuestionChoice')
qc2 = double('QuizQuestionChoice')
allow(QuizQuestionChoice).to receive(:where).with(question_id: 1).and_return([qc1, qc2])
allow(qc1).to recei... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/self_review_response_map_spec.rb | Ruby | mit | 191 | main | 4,628 | describe SelfReviewResponseMap do
let(:assignment) { build(:assignment, id: 1) }
let(:assignment_questionnaire1) { build(:assignment_questionnaire, id: 1, assignment_id: 1, questionnaire_id: 1) }
let(:assignment_questionnaire2) { build(:assignment_questionnaire, id: 2, assignment_id: 1, questionnaire_id: 2) }
l... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | spec/models/checkbox_spec.rb | Ruby | mit | 191 | main | 2,374 | describe Checkbox do
let!(:checkbox) { Checkbox.new id: 10, type: 'Checkbox', seq: 1.0, txt: 'test txt', weight: 11 }
let!(:answer) { Answer.new answer: 1 }
let!(:checkbox1) { Checkbox.create(id: 1, type: 'Checkbox', seq: 2.0, txt: 'test txt2', weight: 11) }
let!(:checkbox2) { Checkbox.create(id: 2, type: 'Chec... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.