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
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/services/stock_attribute_update_test.rb
Ruby
mit
45
main
2,301
# frozen_string_literal: true require "test_helper" class StockAttributeUpdateTest < ActiveSupport::TestCase test "updates stock attributes from valid API response" do stock = create(:stock, ticker: "TEST") mock_response = { "Symbol" => "TEST", "Name" => "Test Company", "Description" => "...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/services/execute_order_test.rb
Ruby
mit
45
main
6,822
# frozen_string_literal: true require "test_helper" class ExecuteOrderTest < ActiveSupport::TestCase test "it creates a debit transaction in portfolio_transactions" do student = create(:student) create(:portfolio, user: student) student.portfolio.portfolio_transactions.create!(amount_cents: 1000, transa...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/services/distribute_earnings_test.rb
Ruby
mit
45
main
3,007
# frozen_string_literal: true require "test_helper" class DistributeEarningsTest < ActiveSupport::TestCase test "only processes verified grade books" do draft_grade_book = create(:grade_book, status: :draft) completed_grade_book = create(:grade_book, status: :completed) assert_no_changes -> { Portfolio...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/services/bulk_student_import_service_test.rb
Ruby
mit
45
main
2,301
# frozen_string_literal: true require "test_helper" class BulkStudentImportServiceTest < ActiveSupport::TestCase include CsvTestHelper def setup @classroom = create(:classroom) @csv_header = "classroom_id,username" end test "parses CSV and calls ImportStudentService for each valid row" do csv_co...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/mailers/previews/devise_mailer_preview.rb
Ruby
mit
45
main
796
# frozen_string_literal: true # test/mailers/previews/devise_mailer_preview.rb class DeviseMailerPreview < ActionMailer::Preview def confirmation_instructions Devise::Mailer.confirmation_instructions(User.first || User.new(email: "test@example.com"), "faketoken") end def reset_password_instructions Dev...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/factories/quarters.rb
Ruby
mit
45
main
282
# frozen_string_literal: true # test/factories/quarters.rb FactoryBot.define do factory :quarter do association :school_year sequence(:number) { |n| ((n - 1) % 4) + 1 } sequence(:name) { |n| "Q#{((n - 1) % 4) + 1} - #{Date.current.year + ((n - 1) / 4)}" } end end
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/factories/users.rb
Ruby
mit
45
main
946
# frozen_string_literal: true FactoryBot.define do factory :admin, class: "User" do password { "Passw0rd" } sequence(:username) { |n| "admin_#{n}" } sequence(:email) { |n| "admin_#{n}@example.com" } admin { true } end factory :student, class: "Student" do type { "Student" } password { "P...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/factories/stocks.rb
Ruby
mit
45
main
767
# frozen_string_literal: true FactoryBot.define do factory :stock do sequence(:ticker) { |n| "STOCK#{n}" } stock_exchange { "NYSE" } sequence(:company_name) { |n| "Sample Company#{n} Inc." } company_website { "https://example.com" } description { "A sample stock for testing" } industry { "Tec...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/factories/portfolio_transactions.rb
Ruby
mit
45
main
534
# frozen_string_literal: true FactoryBot.define do factory :portfolio_transaction do portfolio amount_cents { 1_000 } transaction_type { :credit } end trait :debit do transaction_type { :debit } end trait :credit do transaction_type { :credit } end trait :deposit do transaction...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/factories/orders.rb
Ruby
mit
45
main
990
# frozen_string_literal: true FactoryBot.define do factory :order do stock shares { 1 } user { create(:student) } action { :sell } # Default to sell to avoid validation issues end trait :pending do status { :pending } end trait :completed do status { :completed } end trait :can...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/factories/classroom_enrollments.rb
Ruby
mit
45
main
473
# frozen_string_literal: true FactoryBot.define do factory :classroom_enrollment do student { association :student } classroom { association :classroom } enrolled_at { Time.current } unenrolled_at { nil } primary { false } trait :current do unenrolled_at { nil } end trait :his...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/factories/classrooms.rb
Ruby
mit
45
main
734
# frozen_string_literal: true FactoryBot.define do factory :classroom do sequence(:name) { |n| "Classroom #{n}" } trading_enabled { false } association :school_year after(:build) do |classroom| classroom.grades << build(:grade) if classroom.grades.empty? end trait :with_trading do ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/factories/grade_entry.rb
Ruby
mit
45
main
307
# frozen_string_literal: true # test/factories/grade_entries.rb FactoryBot.define do factory :grade_entry do association :grade_book association :user, factory: :student math_grade { nil } reading_grade { nil } attendance_days { 45 } is_perfect_attendance { false } end end
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/grade_book_test.rb
Ruby
mit
45
main
629
# frozen_string_literal: true # test/models/grade_book_test.rb require "test_helper" class GradeBookTest < ActiveSupport::TestCase test "factory" do assert build(:grade_book).validate! end test "default status is draft" do book = create(:grade_book) assert_equal "draft", book.status assert_pred...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/school_test.rb
Ruby
mit
45
main
3,554
# frozen_string_literal: true require "test_helper" class SchoolTest < ActiveSupport::TestCase # Factory validation test "factory is valid" do school = build(:school) assert school.valid? end # Validation tests test "is valid with valid attributes" do school = build(:school, name: "Test School"...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/classroom_grade_test.rb
Ruby
mit
45
main
1,113
# frozen_string_literal: true require "test_helper" class ClassroomGradeTest < ActiveSupport::TestCase test "factory" do assert build(:classroom_grade).validate! end test "belongs to classroom" do classroom = create(:classroom) cg = create(:classroom_grade, classroom: classroom) assert_equal c...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/teacher_classroom_test.rb
Ruby
mit
45
main
1,867
# frozen_string_literal: true require "test_helper" class TeacherClassroomTest < ActiveSupport::TestCase test "valid teacher_classroom" do teacher = create(:teacher) classroom = create(:classroom) teacher_classroom = TeacherClassroom.new(teacher: teacher, classroom: classroom) assert teacher_classr...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/portfolio_test.rb
Ruby
mit
45
main
7,699
# frozen_string_literal: true require "test_helper" class PortfolioTest < ActiveSupport::TestCase test "factory" do assert build(:portfolio).validate! end test "#cash_balance" do portfolio = create(:portfolio) user = portfolio.user # should increase cash_balance create(:portfolio_transacti...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/portfolio_position_test.rb
Ruby
mit
45
main
4,104
# frozen_string_literal: true require "test_helper" class PortfolioPositionTest < ActiveSupport::TestCase test "current_value and current_value_cents calculation" do portfolio = create(:portfolio) stock = create(:stock, price_cents: 12_000) create(:portfolio_stock, portfolio: portfolio, stock: stock, sh...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/user_test.rb
Ruby
mit
45
main
3,422
# frozen_string_literal: true require "test_helper" class UserTest < ActiveSupport::TestCase test "returns true when the user holds the stock" do student = create(:student, :with_portfolio) stock = create(:stock) create(:portfolio_stock, portfolio: student.portfolio, stock: stock) assert student.hol...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/announcement_test.rb
Ruby
mit
45
main
5,083
# frozen_string_literal: true require "test_helper" class AnnouncementTest < ActiveSupport::TestCase test "should be valid with valid attributes" do announcement = Announcement.new(title: "Test Title", content: "Test content") assert announcement.valid? end test "should require title" do announceme...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/classroom_test.rb
Ruby
mit
45
main
6,282
# frozen_string_literal: true require "test_helper" class ClassroomTest < ActiveSupport::TestCase test "factory" do assert build(:classroom).validate! end test "name is required" do classroom = build(:classroom, name: "") assert_not classroom.valid? assert_includes classroom.errors[:name], "can...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/year_test.rb
Ruby
mit
45
main
1,455
# frozen_string_literal: true require "test_helper" class YearTest < ActiveSupport::TestCase test "factory" do assert build(:year).validate! end test "year presence" do year = build(:year, name: nil) assert_not year.valid? assert year.errors.added?(:name, :blank) end test "year uniqueness...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/portfolio_transaction_test.rb
Ruby
mit
45
main
1,452
# frozen_string_literal: true require "test_helper" class PortfolioTransactionTest < ActiveSupport::TestCase test "factory" do assert build(:portfolio_transaction).validate! end test ".deposits" do transaction1 = create(:portfolio_transaction, :deposit) create(:portfolio_transaction, :debit) cr...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/stock_test.rb
Ruby
mit
45
main
2,196
# frozen_string_literal: true require "test_helper" class StockTest < ActiveSupport::TestCase test "factory" do assert build(:stock).validate! end test "#current_price" do stock = create(:stock, price_cents: 1_000) result = stock.current_price assert_equal 10.0, result end test "archived...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/school_year_test.rb
Ruby
mit
45
main
1,062
# frozen_string_literal: true require "test_helper" class SchoolYearTest < ActiveSupport::TestCase test "factory" do assert build(:school_year).validate! end test "name returns school name and year name" do school_year = build(:school_year) assert_equal "#{school_year.school_name} (#{school_year.ye...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/grade_entry_test.rb
Ruby
mit
45
main
3,239
# frozen_string_literal: true # test/models/grade_entry_test.rb require "test_helper" class GradeEntryTest < ActiveSupport::TestCase test "factory" do assert build(:grade_entry).validate! end test "math_grade, reading_grade, and attendance_days accept any string or nil" do entry = build( :grade_e...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/quarter_test.rb
Ruby
mit
45
main
2,689
# frozen_string_literal: true # test/models/quarter_test.rb require "test_helper" class QuarterTest < ActiveSupport::TestCase test "factory is valid and assigns sequential numbers" do school_year = build(:school_year) q1 = build_stubbed(:quarter, school_year: school_year, number: 1) q2 = build_stubbed(:...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/teacher_test.rb
Ruby
mit
45
main
1,438
# frozen_string_literal: true require "test_helper" class TeacherTest < ActiveSupport::TestCase test "inherits from User" do teacher = create(:teacher) assert_kind_of User, teacher assert_equal "Teacher", teacher.type end test "email is required" do teacher = build(:teacher, email: nil) ass...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/sti_test.rb
Ruby
mit
45
main
762
# frozen_string_literal: true require "test_helper" class StiTest < ActiveSupport::TestCase def test_sti_implementation classroom = create(:classroom) admin = create(:admin, classroom: classroom) assert_equal "User", admin.type student = create(:student, classroom: classroom) assert_equal "Stu...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/grade_test.rb
Ruby
mit
45
main
2,216
# frozen_string_literal: true require "test_helper" class GradeTest < ActiveSupport::TestCase test "factory" do assert build(:grade).validate! end test "has many classroom_grades" do grade = create(:grade) cg1 = create(:classroom_grade, grade: grade) cg2 = create(:classroom_grade, grade: grade)...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/classroom_enrollment_test.rb
Ruby
mit
45
main
6,321
# frozen_string_literal: true require "test_helper" class ClassroomEnrollmentTest < ActiveSupport::TestCase test "factory" do assert build(:classroom_enrollment).valid? end test "belongs to student" do enrollment = build(:classroom_enrollment) assert enrollment.respond_to?(:student) end test "...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/order_test.rb
Ruby
mit
45
main
16,708
# frozen_string_literal: true require "test_helper" class OrderTest < ActiveSupport::TestCase test "factory" do user = create(:student) stock = create(:stock) create(:portfolio_stock, portfolio: user.portfolio, stock: stock, shares: 10) order = create(:order, user: user, stock: stock, shares: 1, ac...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/student_test.rb
Ruby
mit
45
main
8,076
# frozen_string_literal: true require "test_helper" class StudentTest < ActiveSupport::TestCase test "inherits from User" do student = create(:student) assert_kind_of User, student assert_equal "Student", student.type end test "belongs to classroom" do classroom = create(:classroom) student...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/portfolio_snapshot_test.rb
Ruby
mit
45
main
376
# frozen_string_literal: true require "test_helper" class PortfolioSnapshotTest < ActiveSupport::TestCase test "factory" do assert build(:portfolio_snapshot).validate! end test "#current_worth converts cents to dollars" do portfolio_snapshot = build(:portfolio_snapshot, worth_cents: 50_000) assert_...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/models/earnings_summary_test.rb
Ruby
mit
45
main
3,507
# frozen_string_literal: true require "test_helper" class EarningsSummaryTest < ActiveSupport::TestCase setup do @student = create(:student) @portfolio = @student.portfolio @earnings_summary = EarningsSummary.new(@portfolio) end test "should calculate attendance earnings" do create(:portfolio_t...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/integration/navbar_policy_visibility_test.rb
Ruby
mit
45
main
2,302
# frozen_string_literal: true require "test_helper" class NavbarPolicyVisibilityTest < ActionDispatch::IntegrationTest include Devise::Test::IntegrationHelpers def setup classroom = create(:classroom) @student = User.create!(username: "student", type: "Student", password: "password", classroom: classroom...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/integration/order_execution_workflow_test.rb
Ruby
mit
45
main
7,125
# frozen_string_literal: true require "test_helper" class OrderExecutionWorkflowTest < ActionDispatch::IntegrationTest test "buy order execution updates portfolio correctly" do classroom = create(:classroom, :with_trading) student = create(:student, classroom: classroom) portfolio = student.portfolio ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/integration/orders_scoping_test.rb
Ruby
mit
45
main
2,694
# frozen_string_literal: true require "test_helper" class OrdersScopingTest < ActionDispatch::IntegrationTest test "student sees only their own orders" do stock = create(:stock, price_cents: 1_000) classroom = create(:classroom, :with_trading) student1, order1 = create_student_and_order(stock, classroom...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/presenters/attendance_entry_presenter_test.rb
Ruby
mit
45
main
2,692
# frozen_string_literal: true require "test_helper" class AttendanceEntryPresenterTest < ActiveSupport::TestCase test "year_name returns the year name from the nested association" do entry = create_entry(year_name: "2025", quarter_number: 2) assert_equal "2025", AttendanceEntryPresenter.new(entry).year_nam...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/jobs/monthly_portfolio_snapshot_job_test.rb
Ruby
mit
45
main
1,283
# frozen_string_literal: true require "test_helper" class MonthlyPortfolioSnapshotJobTest < ActiveJob::TestCase setup do @user = create(:student) @portfolio = @user.portfolio @target_date = Date.new(2024, 12, 1) end test "creates snapshot calculating cash and stock holdings" do create(:portfoli...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/jobs/stock_attribute_update_job_test.rb
Ruby
mit
45
main
2,050
# frozen_string_literal: true require "test_helper" class StockAttributeUpdateJobTest < ActiveJob::TestCase test "processes all stocks in the database" do stock1 = create(:stock, ticker: "STOCK1") stock2 = create(:stock, ticker: "STOCK2") stock3 = create(:stock, ticker: "STOCK3") Net::HTTP.expects(...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/jobs/stock_prices_update_job_test.rb
Ruby
mit
45
main
3,726
# frozen_string_literal: true require "test_helper" class StockPricesUpdateJobTest < ActiveJob::TestCase STOCK_URL_MATCHER = %r{https://www\.alphavantage\.co/query\?apikey=[^&]+&function=GLOBAL_QUOTE&symbol=[A-Z]+} setup do ENV["ALPHA_VANTAGE_API_KEY"] = "test_api_key" @last_trading_date = Date.parse("20...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/jobs/order_execution_job_test.rb
Ruby
mit
45
main
1,711
# frozen_string_literal: true require "test_helper" class OrderExecutionJobTest < ActiveJob::TestCase test "with pending orders" do portfolio1 = create(:portfolio) student1 = create(:student, portfolio: portfolio1) create( :portfolio_transaction, :deposit, portfolio: portfolio1, ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/facades/classroom_facade_test.rb
Ruby
mit
45
main
3,479
# frozen_string_literal: true require "test_helper" class ClassroomFacadeTest < ActiveSupport::TestCase test "students returns students enrolled via enrollments" do classroom = create(:classroom) student = create(:student) create(:classroom_enrollment, student: student, classroom: classroom) facade...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/system/announcements_test.rb
Ruby
mit
45
main
893
# frozen_string_literal: true require "application_system_test_case" class AnnouncementsTest < ApplicationSystemTestCase setup do @announcement = Announcement.create!( title: "Test Announcement", content: "Test content" ) end test "students can view announcements" do student = create(:s...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/system/admin_earnings_distribution_test.rb
Ruby
mit
45
main
22,263
# frozen_string_literal: true require "application_system_test_case" class AdminEarningsDistributionTest < ApplicationSystemTestCase test "admin finalizes grade book and distributes earnings" do admin = create(:admin) school_year = create(:school_year) quarter = create(:quarter, number: 1, school_year: ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/system/grade_books_test.rb
Ruby
mit
45
main
7,825
# frozen_string_literal: true require "application_system_test_case" class GradeBooksTest < ApplicationSystemTestCase test "teacher updates grade book entries" do classroom = create(:classroom) grade_book = create(:grade_book, classroom:) student1 = create(:student, classroom:) student2 = create(:st...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/system/user_manages_orders_test.rb
Ruby
mit
45
main
2,699
# frozen_string_literal: true require "application_system_test_case" class UserManagesOrdersTest < ApplicationSystemTestCase test "creating a new order" do student = create(:student) student.reload portfolio = student.portfolio create(:portfolio_transaction, :deposit, portfolio: portfolio, amount_ce...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/system/user_manages_classrooms_test.rb
Ruby
mit
45
main
2,230
# frozen_string_literal: true require "application_system_test_case" class UserManagesClassroomsTest < ApplicationSystemTestCase test "admin can create a new classroom" do school1 = create(:school, name: "Elementary School") create(:school, name: "High School") year1 = create(:year, name: "2023-2024") ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/system/student_portfolio_view_test.rb
Ruby
mit
45
main
6,629
# frozen_string_literal: true require "application_system_test_case" class StudentPortfolioViewTest < ApplicationSystemTestCase test "student views portfolio with cash and stock holdings" do classroom = create(:classroom) student = create(:student, :with_portfolio, classroom: classroom) student.reload ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/system/student_trading_flow_test.rb
Ruby
mit
45
main
6,384
# frozen_string_literal: true require "application_system_test_case" class StudentTradingFlowTest < ApplicationSystemTestCase test "student buys a stock" do classroom = create(:classroom, :with_trading) student = create(:student, :with_portfolio, classroom: classroom) student.reload portfolio = stud...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/system/teacher_creates_student_test.rb
Ruby
mit
45
main
4,256
# frozen_string_literal: true require "application_system_test_case" class TeacherCreatesStudentTest < ApplicationSystemTestCase test "teacher can create a student" do username = "student_one" classroom = create(:classroom) teacher = create(:teacher) create(:teacher_classroom, teacher:, classroom:) ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/system/user_manages_schools_test.rb
Ruby
mit
45
main
1,060
# frozen_string_literal: true require "application_system_test_case" class UserManagesSchoolsTest < ApplicationSystemTestCase test "admin can create a school" do admin = create(:admin) sign_in(admin) visit admin_schools_path click_on "New School" fill_in "Name", with: "Test School" click_on...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/system/admin/classrooms_test.rb
Ruby
mit
45
main
1,039
# frozen_string_literal: true require "application_system_test_case" module Admin class ClassroomsTest < ApplicationSystemTestCase setup do @admin = create(:admin) sign_in @admin @classroom = create(:classroom) end test "admin can archive classroom" do visit admin_classroom_url(...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/system/admin/announcements_test.rb
Ruby
mit
45
main
2,415
# frozen_string_literal: true require "application_system_test_case" module Admin class AnnouncementsTest < ApplicationSystemTestCase setup do @admin = create(:admin) sign_in @admin @announcement = Announcement.create!( title: "Test Announcement", content: "Test content" ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/system/admin/admin_navigation_test.rb
Ruby
mit
45
main
540
# frozen_string_literal: true require "application_system_test_case" module Admin class AdminNavigationTest < ApplicationSystemTestCase setup do @admin = create(:admin) sign_in @admin end test "admin navigation shows links" do visit admin_root_path assert_link "School Years" ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/policies/grade_book_policy_test.rb
Ruby
mit
45
main
1,236
# frozen_string_literal: true require "test_helper" class GradeBookPolicyTest < ActiveSupport::TestCase def setup @admin = create(:admin) @owner_teacher = create(:teacher) @other_teacher = create(:teacher) @student = create(:student) @classroom = create(:classroom) @classroom.teachers << @o...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/policies/order_policy_test.rb
Ruby
mit
45
main
3,141
# frozen_string_literal: true require "test_helper" class OrderPolicyTest < ActiveSupport::TestCase test "index?" do order = build(:order, :buy) assert_permit create(:admin), order, :index assert_permit create(:teacher), order, :index assert_permit create(:student), order, :index refute_permit ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/policies/classroom_policy_test.rb
Ruby
mit
45
main
2,272
# frozen_string_literal: true require "test_helper" class ClassroomPolicyTest < ActiveSupport::TestCase test "factory" do assert build(:classroom).validate! end test "classroom policy allows admin all the class routes" do classroom = create(:classroom) admin = create(:admin) assert_permit admi...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/policies/application_policy_test.rb
Ruby
mit
45
main
3,553
# frozen_string_literal: true require "test_helper" class ApplicationPolicyTest < ActiveSupport::TestCase def setup @admin = create(:admin) @teacher = create(:teacher) @student = create(:student) @record = :some_record @the_nil = nil end test "admin_required?" do assert ApplicationPolic...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/policies/portfolio_policy_test.rb
Ruby
mit
45
main
1,515
# frozen_string_literal: true require "test_helper" class PortfolioPolicyTest < ActiveSupport::TestCase def setup @classroom = create(:classroom) @other_classroom = create(:classroom) @student = User.create!(username: "student", type: "Student", password: "password", classroom: @classroom) @other_st...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/policies/stock_policy_test.rb
Ruby
mit
45
main
4,100
# frozen_string_literal: true require "test_helper" class StockPolicyTest < ActiveSupport::TestCase test "factory" do assert build(:stock).validate! end test "student with portfolio can see holdings and trading links for active stocks" do student = create(:student) # ensure portfolio created for st...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/config/schedule_test.rb
Ruby
mit
45
main
1,540
# frozen_string_literal: true require "test_helper" class ScheduleTest < ActiveSupport::TestCase test "recurring configuration file exists and is valid" do recurring_file = Rails.root.join("config/recurring.yml") assert File.exist?(recurring_file), "config/recurring.yml should exist" assert_nothing_rai...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/support/csv_test_helper.rb
Ruby
mit
45
main
249
# frozen_string_literal: true module CsvTestHelper def with_temp_csv_file(content, file_name = "test_import") file = Tempfile.new([file_name, ".csv"]) file.write(content) file.rewind yield file ensure file&.unlink end end
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/helpers/application_helper_test.rb
Ruby
mit
45
main
1,483
# frozen_string_literal: true require "test_helper" class ApplicationHelperTest < ActionView::TestCase test "safe_url returns valid http URL" do url = "http://example.com" result = safe_url(url) assert_equal url, result end test "safe_url returns valid https URL" do url = "https://example.com...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/helpers/admin_helper_test.rb
Ruby
mit
45
main
2,772
# frozen_string_literal: true require "test_helper" class AdminHelperTest < ActionView::TestCase test "format_attribute formats boolean true" do user = build(:admin) result = format_attribute(user, :admin) assert_match(/Yes/, result) assert_match(/bg-green-100/, result) end test "format_attribu...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/helpers/policy_test_helper.rb
Ruby
mit
45
main
628
# frozen_string_literal: true def assert_permit(user, record, action) msg = "User #{user.inspect} should be permitted to #{action} #{record}, but isn't permitted" assert permit(user, record, action), msg end def refute_permit(user, record, action) msg = "User #{user.inspect} should NOT be permitted to #{action}...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/teachers_controller_test.rb
Ruby
mit
45
main
4,384
# frozen_string_literal: true require "test_helper" class TeachersControllerTest < ActionDispatch::IntegrationTest test "index" do admin = create(:admin) sign_in(admin) get admin_teachers_path assert_response :success end test "new" do admin = create(:admin) sign_in(admin) get ne...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/classroom_enrollments_controller_test.rb
Ruby
mit
45
main
2,719
# frozen_string_literal: true require "test_helper" class ClassroomEnrollmentsControllerTest < ActionDispatch::IntegrationTest setup do @classroom = create(:classroom) @student = create(:student, classroom: @classroom) @teacher = create(:teacher) @teacher.classrooms << @classroom end # create ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/students_controller_test.rb
Ruby
mit
45
main
3,781
# frozen_string_literal: true require "test_helper" class StudentsControllerTest < ActionDispatch::IntegrationTest setup do @classroom = create(:classroom) @teacher = create(:teacher, classroom: @classroom) @student = create(:student, classroom: @classroom) @other_classroom = create(:classroom) ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/home_controller_test.rb
Ruby
mit
45
main
3,536
# frozen_string_literal: true require "test_helper" class HomeControllerTest < ActionDispatch::IntegrationTest test "should redirect to sign in when not authenticated" do get root_url assert_redirected_to new_user_session_url end test "should get index when authenticated" do sign_in create(:student...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/portfolios_controller_test.rb
Ruby
mit
45
main
1,798
# frozen_string_literal: true require "test_helper" class PortfoliosControllerTest < ActionDispatch::IntegrationTest test "show with empty portfolio" do portfolio = create(:portfolio) sign_in(portfolio.user) get portfolio_path(portfolio) assert_response :success end test "show with portfolio ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/classrooms_controller_test.rb
Ruby
mit
45
main
12,292
# frozen_string_literal: true require "test_helper" class ClassroomsControllerTest < ActionDispatch::IntegrationTest def setup @admin = create(:admin) @classroom = create(:classroom) @teacher = create(:teacher) @teacher.classrooms << @classroom @student = create(:student, classroom: @classroom) ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/schools_controller_test.rb
Ruby
mit
45
main
1,582
# frozen_string_literal: true require "test_helper" class SchoolsControllerTest < ActionDispatch::IntegrationTest setup do @school = create(:school) @admin_user = create(:admin) sign_in @admin_user end test "should get index" do get admin_schools_url assert_response :success assert_sele...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/orders_controller_test.rb
Ruby
mit
45
main
5,038
# frozen_string_literal: true require "test_helper" class OrdersControllerTest < ActionDispatch::IntegrationTest test "index" do user = create(:teacher) sign_in(user) get orders_path assert_response :success end test "index as guest" do get orders_path assert_redirected_to new_user_s...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/grade_books_controller_test.rb
Ruby
mit
45
main
7,259
# frozen_string_literal: true require "test_helper" class GradeBooksControllerTest < ActionDispatch::IntegrationTest def setup @classroom = create(:classroom) @teacher = create(:teacher) @teacher.classrooms << @classroom @student = create(:student, classroom: @classroom) @first_quarter = create(...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/application_controller_test.rb
Ruby
mit
45
main
1,500
# frozen_string_literal: true require "test_helper" class ApplicationControllerTest < ActionDispatch::IntegrationTest test "after_sign_in_path_for redirects students to root" do create(:student, username: "teststudent", password: "password123") post user_session_path, params: { user: { username: "tes...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/announcements_controller_test.rb
Ruby
mit
45
main
778
# frozen_string_literal: true require "test_helper" class AnnouncementsControllerTest < ActionDispatch::IntegrationTest setup do @user = create(:student) sign_in @user @announcement = Announcement.create!( title: "Test Announcement", content: "Test content" ) end test "should show a...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/stocks_controller_test.rb
Ruby
mit
45
main
695
# frozen_string_literal: true require "test_helper" class StocksControllerTest < ActionDispatch::IntegrationTest test "should get index" do admin = create(:admin) sign_in admin get stocks_url assert_response :success end test "should get show" do stock = create(:stock) admin = create(...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/admin/portfolio_transactions_controller_test.rb
Ruby
mit
45
main
4,063
# frozen_string_literal: true require "test_helper" module Admin class PortfolioTransactionsControllerTest < ActionDispatch::IntegrationTest test "show" do portfolio = build(:portfolio) create(:student, portfolio:) portfolio_transaction = create(:portfolio_transaction, portfolio:) admin ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/admin/users_controller_test.rb
Ruby
mit
45
main
3,909
# frozen_string_literal: true require "test_helper" module Admin class UsersControllerTest < ActionDispatch::IntegrationTest test "index" do create(:admin, username: "marceline") create(:teacher, username: "bonnibel") admin = create(:admin, admin: true, classroom: nil) sign_in(admin) ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/admin/stocks_controller_test.rb
Ruby
mit
45
main
4,394
# frozen_string_literal: true require "test_helper" module Admin class StocksControllerTest < ActionDispatch::IntegrationTest setup do @admin = create(:admin, admin: true) sign_in(@admin) @stock1 = Stock.create!(ticker: "AAPL", company_name: "Apple Inc.", price_cents: 15_000, archived: false)...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/admin/dashboard_controller_test.rb
Ruby
mit
45
main
768
# frozen_string_literal: true require "test_helper" module Admin class DashboardControllerTest < ActionDispatch::IntegrationTest test "admin can access admin dashboard" do admin = create(:admin, admin: true) sign_in(admin) get admin_root_path assert_response :success assert_selec...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/admin/school_years_controller_test.rb
Ruby
mit
45
main
4,663
# frozen_string_literal: true require "test_helper" module Admin class SchoolYearsControllerTest < ActionDispatch::IntegrationTest test "index" do create(:school_year) create(:school_year) admin = create(:admin, admin: true, classroom: nil) sign_in(admin) get admin_school_years_pa...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/admin/teachers_controller_test.rb
Ruby
mit
45
main
8,989
# frozen_string_literal: true require "test_helper" module Admin class TeachersControllerTest < ActionDispatch::IntegrationTest test "index" do teacher1 = create(:teacher, email: "z@example.com") teacher2 = create(:teacher, email: "a@example.com") admin = create(:admin, admin: true, classroom:...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/admin/announcements_controller_test.rb
Ruby
mit
45
main
5,053
# frozen_string_literal: true require "test_helper" module Admin class AnnouncementsControllerTest < ActionDispatch::IntegrationTest setup do @admin = create(:admin, admin: true) sign_in(@admin) @announcement = Announcement.create!( title: "Test Announcement", content: "Test c...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/admin/schools_controller_test.rb
Ruby
mit
45
main
5,287
# frozen_string_literal: true require "test_helper" module Admin class SchoolsControllerTest < ActionDispatch::IntegrationTest setup do @admin = create(:admin, admin: true, classroom: nil) sign_in(@admin) end test "index" do create(:school, name: "Alpha School") create(:school, ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/admin/students_controller_test.rb
Ruby
mit
45
main
14,997
# frozen_string_literal: true require "test_helper" module Admin class StudentsControllerTest < ActionDispatch::IntegrationTest setup do @classroom1 = create(:classroom) @classroom2 = create(:classroom) @admin = create(:admin, admin: true, classroom: nil) sign_in(@admin) end tes...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/admin/classrooms_controller_test.rb
Ruby
mit
45
main
4,653
# frozen_string_literal: true require "test_helper" module Admin class ClassroomsControllerTest < ActionDispatch::IntegrationTest test "index" do classroom1 = create(:classroom, name: "Bravo") classroom2 = create(:classroom, name: "Charlie") classroom3 = create(:classroom, name: "Alpha") ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/admin/base_controller_test.rb
Ruby
mit
45
main
725
# frozen_string_literal: true require "test_helper" module Admin class BaseControllerTest < ActionDispatch::IntegrationTest test "admin can access admin v2 dashboard" do admin = create(:admin, admin: true) sign_in(admin) get admin_root_path assert_response :success end test "n...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/admin/teachers/reactivations_controller_test.rb
Ruby
mit
45
main
1,312
# frozen_string_literal: true require "test_helper" module Admin module Teachers class ReactivationsControllerTest < ActionDispatch::IntegrationTest setup do @admin = create(:admin, admin: true) sign_in(@admin) @classroom1 = create(:classroom, name: "Math 101") @teacher1 =...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
test/controllers/admin/teachers/deactivations_controller_test.rb
Ruby
mit
45
main
1,338
# frozen_string_literal: true require "test_helper" module Admin module Teachers class DeactivationsControllerTest < ActionDispatch::IntegrationTest setup do @admin = create(:admin, admin: true) sign_in(@admin) @classroom1 = create(:classroom, name: "Math 101") @teacher1 =...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
config/importmap.rb
Ruby
mit
45
main
464
# frozen_string_literal: true # Pin npm packages by running ./bin/importmap pin "application" pin "@hotwired/turbo-rails", to: "turbo.min.js" pin "@hotwired/stimulus", to: "stimulus.min.js" pin "@hotwired/stimulus-loading", to: "stimulus-loading.js" pin_all_from "app/javascript/controllers", under: "controllers" pin ...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
config/routes.rb
Ruby
mit
45
main
2,097
# frozen_string_literal: true Rails.application.routes.draw do # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. # Can be used by load balancers and uptime monitors to verify that the app is live. get "up" => "rails/health#show", :as => :rails_health_check root...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
config/application.rb
Ruby
mit
45
main
1,429
# frozen_string_literal: true require_relative "boot" require "rails/all" # Explicitly require Action Text to ensure it's available require "action_text/engine" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module St...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
config/initializers/filter_parameter_logging.rb
Ruby
mit
45
main
490
# Be sure to restart your server when you modify this file. # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. # Use this to limit dissemination of sensitive information. # See the ActiveSupport::ParameterFilter documentation for supported notations and behavio...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
config/initializers/strong_migrations.rb
Ruby
mit
45
main
1,107
# frozen_string_literal: true # Mark existing migrations as safe # rubocop:disable Style/NumericLiterals StrongMigrations.start_after = 20250701200226 # rubocop:enable Style/NumericLiterals # Set timeouts for migrations # If you use PgBouncer in transaction mode, delete these lines and set timeouts on the database us...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
config/initializers/devise.rb
Ruby
mit
45
main
15,483
# frozen_string_literal: true # Assuming you have not yet modified this file, each configuration option below # is set to its default value. Note that some are commented out while others # are not: uncommented lines are intended to protect your configuration from # breaking changes in upgrades (i.e., in the event that...
github
rubyforgood/stocks-in-the-future
https://github.com/rubyforgood/stocks-in-the-future
config/environments/development.rb
Ruby
mit
45
main
2,852
# frozen_string_literal: true require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Make code changes take effect immediately without server restart. config.enable_reloading = true # Do not eager lo...