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
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/system/admin/learners_spec.rb
Ruby
mit
4,370
main
838
require 'rails_helper' RSpec.describe 'Admin learners' do before do sign_in(create(:admin_user)) create(:user, username: 'John', email: 'john@email.com') create(:user, username: 'Jane', email: 'jane@email.com') end it 'can search for learners' do visit admin_learners_path fill_in 'search_t...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/system/admin/invitations_spec.rb
Ruby
mit
4,370
main
2,618
require 'rails_helper' RSpec.describe 'Admin invitations' do it 'invites a new team member' do sign_in(create(:admin_user)) # Create a new invitation visit admin_team_path click_on('Invite new member') fill_in('Name', with: 'John Doe') fill_in('Email', with: 'john@example.com') select(...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/system/admin/reactivations_spec.rb
Ruby
mit
4,370
main
1,377
require 'rails_helper' RSpec.describe 'Admin team members reactivations' do it 'reactivates a team member' do admin = create(:admin_user, :activated) deactivated_admin = create(:admin_user, :deactivated, email: 'deactivated@admin.com') sign_in(admin) visit admin_team_path within("#admin_user_#...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/system/admin/announcements_spec.rb
Ruby
mit
4,370
main
2,262
require 'rails_helper' RSpec.describe 'Admin announcements' do before do sign_in(create(:admin_user)) visit admin_flags_path end context 'when creating a new announcement' do it 'displays the announcement message and expires at on the index page' do visit admin_announcements_path click_o...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/system/admin/deactivations_spec.rb
Ruby
mit
4,370
main
969
require 'rails_helper' RSpec.describe 'Admin team member deactivation' do it 'deactivates a team member' do admin = create(:admin_user, :activated) other_admin = create(:admin_user, :activated, email: 'otheradmin@odin.com', password: 'password') sign_in(admin) visit admin_team_path within("#ad...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/system/admin/flags_spec.rb
Ruby
mit
4,370
main
4,219
require 'rails_helper' RSpec.describe 'Admin flags' do let!(:flag) { create(:flag, project_submission:) } let(:project_submission) { create(:project_submission, lesson:, user: submission_owner) } let(:lesson) { create(:lesson, is_project: true, accepts_submission: true, previewable: true) } let(:submission_own...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/system/user_dashboard/resume_course_spec.rb
Ruby
mit
4,370
main
914
require 'rails_helper' RSpec.describe 'Resuming Course from User Dashboard' do let!(:default_path) { create(:path, default_path: true) } let!(:foundations_course) { create(:course, title: 'Foundations', path: default_path) } let!(:incomplete_lesson) { create(:lesson, course: foundations_course) } context 'whe...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/system/user_dashboard/open_course_spec.rb
Ruby
mit
4,370
main
982
require 'rails_helper' RSpec.describe 'Opening Course from User Dashboard' do let!(:default_path) { create(:path, default_path: true) } let!(:foundations_course) { create(:course, title: 'Foundations', path: default_path) } context 'when user has completed a course' do before do first_lesson = create(...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/system/user_dashboard/start_course_spec.rb
Ruby
mit
4,370
main
1,442
require 'rails_helper' RSpec.describe 'Starting Course from User Dashboard' do let!(:default_path) { create(:path, default_path: true) } let!(:foundations_course) { create(:course, title: 'Foundations', path: default_path) } let!(:user) { create(:user) } context 'when new user starts default path' do befo...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/system/user_project_submissions/edit_submission_spec.rb
Ruby
mit
4,370
main
1,684
require 'rails_helper' RSpec.describe 'Editing a Project Submission on the Dashboard' do let(:user) { create(:user) } let(:another_user) { create(:user) } let(:lesson) { create(:lesson, :project) } let(:edited_field_values) do { repo_url: 'https://github.com/edited-project-repo-url', live_previ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/system/user_project_submissions/delete_submission_spec.rb
Ruby
mit
4,370
main
1,030
require 'rails_helper' RSpec.describe 'Deleting a Project Submission on the Dashboard' do let(:user) { create(:user) } before do create(:project_submission, user:, lesson: create(:lesson, :project, title: 'My Project')) create(:project_submission, user:, lesson: create(:lesson, :project, title: 'Another P...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/system/lesson_project_submissions/edit_submission_spec.rb
Ruby
mit
4,370
main
1,099
require 'rails_helper' RSpec.describe 'Editing a Project Submission' do let(:user) { create(:user) } let(:lesson) { create(:lesson, :project) } let(:edited_field_values) do { repo_url: 'https://github.com/edited-project-repo-url', live_preview_url: 'http://edited-live-preview-url.com' } end...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/system/lesson_project_submissions/like_spec.rb
Ruby
mit
4,370
main
2,353
require 'rails_helper' RSpec.describe 'Liking project submissions' do let(:user) { create(:user) } let(:lesson) { create(:lesson, :project) } context 'when the submission has no likes' do before do create(:project_submission, lesson:) sign_in(user) create(:project_submission, user_id: use...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/system/lesson_project_submissions/flag_submission_spec.rb
Ruby
mit
4,370
main
955
require 'rails_helper' RSpec.describe 'Flagging a Project Submission' do let(:user) { create(:user) } let(:lesson) { create(:lesson, :project) } let!(:project_submission) { create(:project_submission, lesson:) } before do sign_in(user) visit lesson_project_submissions_path(lesson) end it 'success...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/system/lesson_project_submissions/delete_submission_spec.rb
Ruby
mit
4,370
main
708
require 'rails_helper' RSpec.describe 'Deleting a Project Submission' do let(:user) { create(:user) } let(:lesson) { create(:lesson, :project) } before do sign_in(user) visit lesson_path(lesson) Pages::ProjectSubmissions::Form.new.open.fill_in.submit end it 'removes a submission' do within(...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/system/lesson_project_submissions/add_submission_spec.rb
Ruby
mit
4,370
main
2,611
require 'rails_helper' RSpec.describe 'Add a Project Submission' do context 'when a user is signed in' do let(:lesson) { create(:lesson, :project) } let(:user) { create(:user) } let(:another_user) { create(:user) } before do sign_in(user) visit lesson_path(lesson) end it 'succes...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/lib/seeds/course_builder_spec.rb
Ruby
mit
4,370
main
4,702
require './lib/seeds/course_builder' require 'rails_helper' RSpec.describe Seeds::CourseBuilder do subject(:course_builder) do described_class.build(path, position) do |course| course.identifier_uuid = 'course_uuid' course.title = 'Foundations' course.description = 'a foundation course' c...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/lib/seeds/lesson_builder_spec.rb
Ruby
mit
4,370
main
3,562
require './lib/seeds/lesson_builder' require 'rails_helper' RSpec.describe Seeds::LessonBuilder do subject(:lesson_builder) { described_class.build(section, position, attributes) } let(:section) { create(:section, course:) } let(:course) { create(:course) } let(:position) { 1 } let(:attributes) do { ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/lib/seeds/path_builder_spec.rb
Ruby
mit
4,370
main
3,828
require './lib/seeds/path_builder' require 'rails_helper' RSpec.describe Seeds::PathBuilder do subject(:path_builder) do described_class.build do |path| path.identifier_uuid = 'path_uuid' path.title = 'Foundations' path.description = 'a foundation path' path.position = 1 path.defaul...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/lib/seeds/section_builder_spec.rb
Ruby
mit
4,370
main
3,257
require './lib/seeds/section_builder' require 'rails_helper' RSpec.describe Seeds::SectionBuilder do subject(:section_builder) do described_class.build(course, position) do |section| section.identifier_uuid = 'section_uuid' section.title = 'Basics Section' section.description = 'a basics sectio...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/lib/kramdown/document_sections_spec.rb
Ruby
mit
4,370
main
2,326
require 'rails_helper' require './lib/kramdown/document_sections' RSpec.describe Kramdown::DocumentSections do describe '#all_sections' do context "when content has sectionable headings(h3's)" do let(:markdown) do <<~MARKDOWN ### First header Test first header ### Se...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/lib/kramdown/content_section_spec.rb
Ruby
mit
4,370
main
1,972
require 'rails_helper' require './lib/kramdown/content_section' RSpec.describe Kramdown::ContentSection do describe '#content' do it 'returns content for the section' do section = described_class.new(title: 'section title', content: "some markdown\n") expect(section.content).to eq( "<sectio...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/new_tab_text_link_component_spec.rb
Ruby
mit
4,370
main
1,753
require 'rails_helper' RSpec.describe NewTabTextLinkComponent, type: :component do it 'renders the link with a new tab svg icon' do component = described_class.new( text: 'link text', href: 'link href', classes: 'a-class' ) render_inline(component) expect(page).to have_css('svg > ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/pagination_component_spec.rb
Ruby
mit
4,370
main
1,002
require 'rails_helper' RSpec.describe PaginationComponent, type: :component do context 'when there is more than one page' do it 'renders the pagination component' do with_request_url('/admin/flags') do pagy = instance_double(Pagy, pages: 3, next: 3, prev: 1, from: 1, to: 10, count: 30) comp...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/lesson_group_component_spec.rb
Ruby
mit
4,370
main
581
require 'rails_helper' RSpec.describe LessonGroupComponent, type: :component do it 'renders the list with a title' do component = described_class.new(title: 'HTML Basics', lessons: []) render_inline(component) expect(page).to have_css('h3', text: 'HTML Basics') end it 'renders the list of lessons'...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/announcement_component_spec.rb
Ruby
mit
4,370
main
1,960
require 'rails_helper' RSpec.describe AnnouncementComponent, type: :component do context 'with an announcement' do it 'renders the announcement' do announcement = create(:announcement, message: 'Hello, world!') component = described_class.new(announcement:) render_inline(component) expe...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/card_component_spec.rb
Ruby
mit
4,370
main
429
require 'rails_helper' RSpec.describe CardComponent, type: :component do it 'renders the card with custom classes' do component = described_class.new(classes: 'a-class') render_inline(component) expect(page).to have_css('div.a-class') end it 'renders the card with an id' do component = describ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/content_container_component_spec.rb
Ruby
mit
4,370
main
750
require 'rails_helper' RSpec.describe ContentContainerComponent, type: :component do it 'renders content' do component = described_class.new render_inline(component) { 'Some riveting content' } expect(page).to have_content('Some riveting content') end it 'renders content with classes' do compo...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/notification_component_spec.rb
Ruby
mit
4,370
main
1,157
require 'rails_helper' RSpec.describe NotificationComponent, type: :component do let(:notification) do create(:notification, id: 1, title: 'test title', message: 'test message') end before do render_inline(described_class.new(notification:)) end it "renders the component with a link to the notifica...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/complete/icon_component_spec.rb
Ruby
mit
4,370
main
646
require 'rails_helper' RSpec.describe Complete::IconComponent, type: :component do let(:user) { create(:user) } it 'renders the icon button with the lesson complete state' do lesson = create(:lesson, :complete) component = described_class.new(lesson:, current_user: user) render_inline(component) ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/complete/button_component_spec.rb
Ruby
mit
4,370
main
556
require 'rails_helper' RSpec.describe Complete::ButtonComponent, type: :component do it 'renders the button with the lesson complete state' do lesson = create(:lesson, :complete) component = described_class.new(lesson:) render_inline(component) expect(page).to have_button('Lesson Completed') end ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/oauth/connect_button_component_spec.rb
Ruby
mit
4,370
main
315
require 'rails_helper' RSpec.describe Oauth::ConnectButtonComponent, type: :component do it 'renders a oauth provider connect button' do component = described_class.new(provider: :github, resource_name: 'user') render_inline(component) expect(page).to have_content('Sign in with Github') end end
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/nav/item_component_spec.rb
Ruby
mit
4,370
main
1,298
require 'rails_helper' RSpec.describe Nav::ItemComponent, type: :component do context 'when mobile' do it 'renders mobile nav item' do component = described_class.new( path: '/home', text: 'Home', test_id: 'nav-home', icon_path: 'icons/home.svg', options: { mobile: t...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/theme/switcher_component_spec.rb
Ruby
mit
4,370
main
633
require 'rails_helper' RSpec.describe Theme::SwitcherComponent, type: :component do context 'when dark mode is enabled' do it 'renders the light mode button' do component = described_class.new(current_theme: Users::Theme.for('dark')) render_inline(component) expect(page).to have_link(href: '/...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/charts/horizontal_bar_chart_component_spec.rb
Ruby
mit
4,370
main
697
require 'rails_helper' RSpec.describe Charts::HorizontalBarChartComponent, type: :component do context 'when the dataset is smaller than 5' do it 'renders the chart with an appropiate height' do component = described_class.new(labels: %w[A B], datasets: [1, 2]) render_inline(component) expect...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/user/learning_goal_component_spec.rb
Ruby
mit
4,370
main
774
require 'rails_helper' RSpec.describe User::LearningGoalComponent, type: :component do context 'when the user has a learning goal' do it 'renders the learning goal' do user = create(:user, learning_goal: 'Learn Ruby') component = described_class.new(current_user: user) render_inline(component)...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/user/avatar_component_spec.rb
Ruby
mit
4,370
main
733
require 'rails_helper' RSpec.describe User::AvatarComponent, type: :component do context 'when the user has an avatar' do it 'renders the users avatar' do user = create(:user, avatar: 'http://github/avatar.png') component = described_class.new(current_user: user, classes: 'w-12') render_inline...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/sections/lesson_component_spec.rb
Ruby
mit
4,370
main
703
require 'rails_helper' RSpec.describe Sections::LessonComponent, type: :component do context 'when a project' do it 'returns the project title' do lesson = create(:lesson, is_project: true, title: 'HTML Basics') component = described_class.new(lesson:, current_user: nil) render_inline(componen...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/team/former_member_component_spec.rb
Ruby
mit
4,370
main
826
require 'rails_helper' RSpec.describe Team::FormerMemberComponent, type: :component do let(:former_member) do { image: 'https://example.com/avatar.png', name: 'John Doe', url: 'https://example.com' } end it 'renders the former team members avatar' do component = described_class.new...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/team/member_component_spec.rb
Ruby
mit
4,370
main
2,112
require 'rails_helper' RSpec.describe Team::MemberComponent, type: :component do let(:team_member) do { image: 'https://example.com/avatar.png', name: 'John Doe', location: 'Berlin', joined: '2019', socials: [ { name: 'twitter', url: 'https://twitter.com' }, { name: ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/team/navigation_component_spec.rb
Ruby
mit
4,370
main
643
require 'rails_helper' RSpec.describe Team::NavigationComponent, type: :component do it 'renders navigation links for the different roles' do component = described_class.new( roles: role = [ { name: 'Core', url: '#core' }, { name: 'Maintainers', url: '#maintainers' }, { name: 'Moder...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/project_submissions/user_solution_component_spec.rb
Ruby
mit
4,370
main
707
require 'rails_helper' RSpec.describe ProjectSubmissions::UserSolutionComponent, type: :component do context 'when the project submission is present' do it 'renders the component' do project_submission = create(:project_submission) component = described_class.new(project_submission:) render_in...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/project_submissions/like_component_spec.rb
Ruby
mit
4,370
main
1,656
require 'rails_helper' RSpec.describe ProjectSubmissions::LikeComponent, type: :component do context 'when the the project submission is liked' do it 'renders the component as liked' do project_submission = create(:project_submission, :liked) component = described_class.new(project_submission:) ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/project_submissions/item_component_spec.rb
Ruby
mit
4,370
main
704
require 'rails_helper' RSpec.describe ProjectSubmissions::ItemComponent, type: :component do context 'when the project submission is present' do it 'renders the item component' do project_submission = create(:project_submission) component = described_class.new(project_submission:) render_inlin...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/flags/action_button_component_spec.rb
Ruby
mit
4,370
main
605
require 'rails_helper' RSpec.describe Flags::ActionButtonComponent, type: :component do context 'when the flag is active' do it 'renders the flag action button' do flag = build_stubbed(:flag, :active) component = described_class.new(flag:) render_inline(component) expect(page).to have_c...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/forms/date_picker_component_spec.rb
Ruby
mit
4,370
main
1,471
require 'rails_helper' RSpec.describe Forms::DatePickerComponent, type: :component do context 'when min is smaller than the value of the date picker' do it 'renders the date picker with the min date' do component = described_class.new(name: 'date', value: '2021-01-01', min: '2020-01-01') render_inli...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/course/badge_component_spec.rb
Ruby
mit
4,370
main
698
require 'rails_helper' RSpec.describe Course::BadgeComponent, type: :component do context 'when the user is signed in' do it 'renders the loading progress circle' do course = create(:course) user = create(:user) component = described_class.new(course:) sign_in(user) render_inline(c...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/paths/view_button_component_spec.rb
Ruby
mit
4,370
main
647
require 'rails_helper' RSpec.describe Paths::ViewButtonComponent, type: :component do context 'when learner is signed in' do it 'renders the view button' do path = create(:path) current_user = create(:user) component = described_class.new(current_user:, path:) render_inline(component) ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/paths/select_button_component_spec.rb
Ruby
mit
4,370
main
696
require 'rails_helper' RSpec.describe Paths::SelectButtonComponent, type: :component do context 'when leaner is on the path' do it 'renders the continue button' do path = create(:path) current_user = create(:user, path:) component = described_class.new(current_user:, path:) render_inline...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/progress_circle/component_spec.rb
Ruby
mit
4,370
main
731
require 'rails_helper' RSpec.describe ProgressCircle::Component, type: :component do context 'when percentatge is 0' do it 'reners 0%' do component = described_class.new(percentage: 0) render_inline(component) expect(page).to have_content('0% Complete') end end context 'when percenta...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/overlays/dialog_component_spec.rb
Ruby
mit
4,370
main
245
require 'rails_helper' RSpec.describe Overlays::DialogComponent, type: :component do it 'renders' do component = described_class.new(id: 'test-dialog') render_inline(component) expect(page).to have_css('#test-dialog') end end
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/overlays/flash_component_spec.rb
Ruby
mit
4,370
main
898
require 'rails_helper' RSpec.describe Overlays::FlashComponent, type: :component do context 'when the type is alert' do it 'renders an alert flash' do component = described_class.new(type: 'alert', message: 'Fire!') render_inline(component) expect(page).to have_css('.bg-red-100') expect...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/previews/announcement_component_preview.rb
Ruby
mit
4,370
main
462
class AnnouncementComponentPreview < ViewComponent::Preview # @param message [String] text "The text to display in the announcement" def with_announcment(message: 'Hello!') render(AnnouncementComponent.new(announcement: default_announcment(message:))) end private def default_announcment(**opts) defa...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/previews/flash_component_preview.rb
Ruby
mit
4,370
main
334
# @hidden # Not currently working, need to figure out how to pass helpers to the context class FlashComponentPreview < ViewComponent::Preview def alert render(Overlays::FlashComponent.new(type: :alert, message: 'Alert!')) end def notice render(Overlays::FlashComponent.new(type: :notice, message: 'Notice!...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/previews/notification_component_preview.rb
Ruby
mit
4,370
main
538
class NotificationComponentPreview < ViewComponent::Preview # @!group # @display bg_color "#eee" def unread render(NotificationComponent.new(notification: unread_notification)) end def read render(NotificationComponent.new(notification: read_notification)) end private def unread_notification ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/previews/sections/lesson_component_preview.rb
Ruby
mit
4,370
main
1,010
module Sections class LessonComponentPreview < ViewComponent::Preview # @!group def with_lesson render(LessonComponent.new(lesson: Lesson.first, current_user: User.first)) end def with_completed_lesson lesson = Lesson.first current_user = User.last complete_lesson!(lesson, cur...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/previews/complete/icon_component_preview.rb
Ruby
mit
4,370
main
659
module Complete class IconComponentPreview < ViewComponent::Preview # @!group def uncompleted render(IconComponent.new(lesson: Lesson.first, current_user: User.first)) end def completed lesson = Lesson.first current_user = User.last complete_lesson!(lesson, current_user) ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/previews/complete/button_component_preview.rb
Ruby
mit
4,370
main
665
module Complete class ButtonComponentPreview < ViewComponent::Preview # @!group def uncompleted render(ButtonComponent.new(lesson: Lesson.first, current_user: User.find(21))) end def completed lesson = Lesson.first current_user = User.last complete_lesson!(lesson, User.last) ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/components/previews/about_page/belief_component_preview.rb
Ruby
mit
4,370
main
489
module AboutPage # @label Media Cards # Note: Name is no longer really representative of what this does, should be refactored to a more general name class BeliefComponentPreview < ViewComponent::Preview def with_about_page_collection render(BeliefComponent.with_collection(I18n.t('static_pages.about.beli...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/policies/submission_like_policy_spec.rb
Ruby
mit
4,370
main
1,366
require 'rails_helper' RSpec.describe SubmissionLikePolicy do describe '#allowed?' do context 'when there are recent accounts with the same ip' do it 'cannot like the project submission' do user = create(:user, current_sign_in_ip: '127.0.0.1') create(:user, last_sign_in_ip: user.current_sig...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/policies/admin_user_policy_spec.rb
Ruby
mit
4,370
main
3,767
require 'rails_helper' RSpec.describe AdminUserPolicy do describe '#change_role?' do subject(:policy) { described_class.new(admin_user).change_role? } context 'when the admin user has the core role' do let(:admin_user) { create(:admin_user, role: 'core') } it { is_expected.to be(true) } end...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/redirects_spec.rb
Ruby
mit
4,370
main
1,976
require 'rails_helper' RSpec.describe 'Redirects' do context 'when a request is made to web development 101 paths' do it 'redirects the old web development 101 course path to the foundations path' do get '/courses/web-development-101' expect(response).to redirect_to('/paths/foundations') end ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/static_pages_spec.rb
Ruby
mit
4,370
main
1,155
require 'rails_helper' RSpec.describe 'Static Pages' do describe 'GET #home' do it 'renders the home page' do get home_path expect(response).to have_http_status(:ok) end end describe 'GET #about' do it 'renders the about page' do get about_path expect(response).to have_http...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/themes_spec.rb
Ruby
mit
4,370
main
635
require 'rails_helper' RSpec.describe 'Themes' do describe 'PUT #update' do before do cookies[:theme] = 'light' end context 'when the theme is valid' do it 'switches themes' do expect do put themes_path(format: :turbo_stream, params: { theme: 'dark' }) end.to change...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/errors_spec.rb
Ruby
mit
4,370
main
1,009
require 'rails_helper' RSpec.describe 'Error Pages' do describe 'GET 404' do it 'returns the correct status code' do get '/404' expect(response).to have_http_status(:not_found) end it 'returns the correct page' do get '/404' expect(response.body).to include('Looks like you\'re lo...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/paths_spec.rb
Ruby
mit
4,370
main
636
require 'rails_helper' RSpec.describe 'Paths' do describe 'GET #path' do context 'when path has more than one course' do it 'renders the path page' do path = create(:path) create(:course, path:) create(:course, path:) get path_url(path) expect(response).to have_htt...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/users/registrations_spec.rb
Ruby
mit
4,370
main
732
require 'rails_helper' RSpec.describe 'User Registrations' do describe 'POST #create' do around do |example| perform_enqueued_jobs do example.run end end context 'when the user is valid' do it 'redirects to the dashboard' do post user_registration_path(params: { user: a...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/guides/community_spec.rb
Ruby
mit
4,370
main
1,001
require 'rails_helper' RSpec.describe 'Community Guides' do describe 'GET #show' do it 'renders the community guides' do get guides_community_path expect(response).to have_http_status(:ok) end end describe 'GET #rules' do it 'renders the community rules guide' do get rules_guides_...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/guides/installations_spec.rb
Ruby
mit
4,370
main
244
require 'rails_helper' RSpec.describe 'Installation Guides' do describe 'GET #index' do it 'renders the installation guides index' do get guides_installations_path expect(response).to have_http_status(:ok) end end end
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/lessons/previews_spec.rb
Ruby
mit
4,370
main
457
require 'rails_helper' RSpec.describe 'Lesson preview' do describe 'GET #show' do it 'renders the preview input page' do get lessons_preview_path expect(response).to have_http_status(:success) end end describe 'POST #create' do it 'converts the markdown to html' do post lessons_pre...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/lessons/previews/share_spec.rb
Ruby
mit
4,370
main
836
require 'rails_helper' RSpec.describe 'Share preview' do describe 'POST #create' do context 'when the preview is valid' do it 'creates a sharable preview' do expect do post lessons_preview_share_path(content: '# hello', format: :turbo_stream) end.to change { LessonPreview.count }....
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/team_members_spec.rb
Ruby
mit
4,370
main
1,887
require 'rails_helper' RSpec.describe 'Team members' do describe 'GET #index' do context 'when signed in as an admin' do it 'renders the team members page' do sign_in(create(:admin_user)) get admin_team_path expect(response).to have_http_status(:ok) end end context ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/passwords_spec.rb
Ruby
mit
4,370
main
564
require 'rails_helper' RSpec.describe 'Admin users passwords' do describe 'GET #new' do it 'redirects to the admin sign in page' do get new_admin_user_password_path expect(response).to redirect_to(new_admin_user_session_path) expect(flash[:alert]).to eq('Please sign in') end end descr...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/learners_spec.rb
Ruby
mit
4,370
main
2,491
require 'rails_helper' RSpec.describe 'Learners' do describe 'GET #index' do context 'when signed in as an admin' do it 'renders the index page' do admin = create(:admin_user) sign_in(admin) get admin_learners_path expect(response).to have_http_status(:ok) end en...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/invitations_spec.rb
Ruby
mit
4,370
main
4,239
require 'rails_helper' RSpec.describe 'Admin invitations' do describe 'GET #new' do context 'when an admin is signed in' do it 'renders the new invitation page' do admin = create(:admin_user) sign_in(admin) get new_admin_user_invitation_path expect(response).to have_http_s...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/profile_spec.rb
Ruby
mit
4,370
main
1,927
require 'rails_helper' RSpec.describe 'Admin user profile' do describe 'GET #edit' do context 'when signed in as an admin' do it 'renders the edit profile page' do admin = create(:admin_user) sign_in(admin) get edit_admin_profile_path expect(response).to have_http_status(:...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/two_factor_authentication_spec.rb
Ruby
mit
4,370
main
2,294
require 'rails_helper' RSpec.describe 'Two factor authentication' do describe 'GET #new' do context 'when two factor authentication is already enabled' do it 'redirects to the dashboard' do admin = create(:admin_user, otp_required_for_login: true) sign_in(admin) get new_admin_two_f...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/team_members/reactivation_spec.rb
Ruby
mit
4,370
main
2,977
require 'rails_helper' RSpec.describe 'Team member reactivation' do describe 'PUT #update' do context 'when signed in as an admin and the team member exists' do before do Mail::TestMailer.deliveries.clear end it 'reactivates the team member' do admin = create(:admin_user) ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/team_members/activities_spec.rb
Ruby
mit
4,370
main
642
require 'rails_helper' RSpec.describe 'Team member activities' do describe 'GET #index' do context 'when signed in as an admin' do it 'renders the team activities page' do admin = create(:admin_user) sign_in(admin) get admin_team_activities_path expect(response).to have_ht...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/team_members/deactivation_spec.rb
Ruby
mit
4,370
main
1,940
require 'rails_helper' RSpec.describe 'Team member deactivation' do describe 'PUT #update' do context 'when signed in as an admin and the team member exists' do it 'deactivates the team member' do admin = create(:admin_user) active_admin = create(:admin_user, :activated) sign_in(ad...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/team_members/two_factor_reset_spec.rb
Ruby
mit
4,370
main
2,100
require 'rails_helper' RSpec.describe 'Team member two factor reset' do describe 'PUT #update' do context 'when signed in as an admin and the team member exists' do it 'resets the admins two factor credentials' do admin = create(:admin_user) other_admin = create(:admin_user, otp_secret: 'se...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/team_members/password_resets_spec.rb
Ruby
mit
4,370
main
1,571
require 'rails_helper' RSpec.describe 'Team member password resets' do before do Mail::TestMailer.deliveries.clear end describe 'POST #create' do context 'when signed in as an admin and the team member exists' do it 'sends a password reset email' do admin = create(:admin_user) othe...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/team_members/role_spec.rb
Ruby
mit
4,370
main
3,636
require 'rails_helper' RSpec.describe 'Team member role' do describe 'GET #edit' do context 'when signed in as an admin and the team member exists' do it 'renders the edit template' do admin = create(:admin_user) team_member = create(:admin_user) sign_in(admin) get edit_ad...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/team_members/resend_invitation_spec.rb
Ruby
mit
4,370
main
2,140
require 'rails_helper' RSpec.describe 'Resend team member invite' do before do Mail::TestMailer.deliveries.clear end describe 'POST #create' do context 'when signed in as an admin and the team member is pending' do it 'sends another invitation email to the team member' do admin = create(:a...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/profile/password_spec.rb
Ruby
mit
4,370
main
1,529
require 'rails_helper' RSpec.describe 'Admin user profile password' do describe 'PATCH #update' do context 'when signed in as an admin and the form is valid' do it "updates the admin user's password" do admin = create(:admin_user, password: 'oldpassword') sign_in(admin) expect do ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/reports/paths_spec.rb
Ruby
mit
4,370
main
630
require 'rails_helper' RSpec.describe 'Reports - path' do describe 'GET #show' do context 'when signed in as an admin' do it 'renders the path report' do admin = create(:admin_user) path = create(:path) sign_in(admin) get admin_reports_path_path(path) expect(respon...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/reports/users_spec.rb
Ruby
mit
4,370
main
564
require 'rails_helper' RSpec.describe 'Reports - users' do describe 'GET #index' do context 'when signed in as an admin' do it 'renders the users report' do admin = create(:admin_user) sign_in(admin) get admin_reports_users_path expect(response).to have_http_status(:ok) ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/admin/reports/lesson_completions_spec.rb
Ruby
mit
4,370
main
615
require 'rails_helper' RSpec.describe 'Reports - lesson completions' do describe 'GET #show' do context 'when signed in as an admin' do it 'renders the lesson completions report' do admin = create(:admin_user) sign_in(admin) get admin_reports_lesson_completions_path expect...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/requests/api/points_spec.rb
Ruby
mit
4,370
main
4,274
require 'rails_helper' RSpec.describe 'Static Pages' do describe 'GET #index' do context 'when not authenticated' do it 'returns 401 forbidden' do get api_points_path expect(response).to have_http_status(:unauthorized) end end context 'when authenticated' do around do ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/jobs/discard_project_submission_job_spec.rb
Ruby
mit
4,370
main
509
require 'rails_helper' RSpec.describe DiscardProjectSubmissionJob do subject(:job) { described_class.new } describe '#perform' do context "when the project_submission hasn't been updated for more than 7 days" do let!(:project_submission) { create(:project_submission, discard_at: 7.days.from_now) } ...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/jobs/destroy_expired_lesson_previews_job_spec.rb
Ruby
mit
4,370
main
596
require 'rails_helper' RSpec.describe DestroyExpiredLessonPreviewsJob do subject(:job) { described_class.new } describe '#perform' do context 'when there are expired lesson previews' do it 'deletes 3 expired lesson previews' do create_list(:lesson_preview, 3, created_at: 1.month.ago) ex...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/jobs/refresh_materialized_views_job_spec.rb
Ruby
mit
4,370
main
836
require 'rails_helper' RSpec.describe RefreshMaterializedViewsJob do subject(:job) { described_class.new } describe '#perform' do before do allow(Reports::AllLessonCompletionsDayStat).to receive(:refresh) allow(Reports::PathLessonCompletionsDayStat).to receive(:refresh) allow(Reports::UserSi...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/jobs/lessons/update_content_job_spec.rb
Ruby
mit
4,370
main
671
require 'rails_helper' RSpec.describe Lessons::UpdateContentJob do subject(:job) { described_class.new } describe '#perform' do it 'updates the content of the lessons' do lesson_one = create(:lesson, github_path: '/lesson_one_github_url') lesson_two = create(:lesson, github_path: '/lesson_two_gith...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/jobs/lessons/import_all_content_job_spec.rb
Ruby
mit
4,370
main
399
require 'rails_helper' RSpec.describe Lessons::ImportAllContentJob do subject(:job) { described_class.new } describe '#perform' do before do allow(Github::LessonContentImporter).to receive(:import_all) end it 'delegates to the lesson content importer service' do job.perform expect(...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/factories/announcements.rb
Ruby
mit
4,370
main
327
FactoryBot.define do factory :announcement do message { 'a message for all users' } expires_at { 1.day.from_now } created_by { association :admin_user } learn_more_url { 'https://example.com' } trait :without_validations do to_create { |instance| instance.save(validate: false) } end e...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/factories/lessons.rb
Ruby
mit
4,370
main
712
FactoryBot.define do factory :lesson do section sequence(:title) { |n| "test lesson#{n}" } sequence(:position) { |n| n } github_path { '/lesson_course/lesson_title.md' } identifier_uuid { SecureRandom.uuid } trait :project do is_project { true } accepts_submission { true } p...
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/factories/flags.rb
Ruby
mit
4,370
main
319
FactoryBot.define do factory :flag do flagger { association :user } project_submission reason { :spam } extra { "It's offensive" } trait :active do status { :active } end trait :resolved do status { :resolved } resolved_by { association :admin_user } end end end
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/factories/courses.rb
Ruby
mit
4,370
main
226
FactoryBot.define do factory :course do path sequence(:title) { |n| "test course#{n}" } sequence(:position) { |n| n } identifier_uuid { SecureRandom.uuid } badge_uri { 'badge-foundations.svg' } end end
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/factories/notifications.rb
Ruby
mit
4,370
main
202
FactoryBot.define do factory :notification do recipient factory: :user type { '' } params { '' } read_at { Time.zone.now } url { '' } message { '' } title { '' } end end
github
TheOdinProject/theodinproject
https://github.com/TheOdinProject/theodinproject
spec/factories/project_submissions.rb
Ruby
mit
4,370
main
367
FactoryBot.define do factory :project_submission do repo_url { 'https://github.com/user/repo' } live_preview_url { 'http://mysite.com' } user discard_at { nil } lesson { association :lesson, previewable: true } trait :liked do after(:create, &:liked!) end trait :unliked do ...