Skip to content

Instantly share code, notes, and snippets.

@oguzcanhuner
Created June 28, 2016 11:59
Show Gist options
  • Save oguzcanhuner/9e4b54b819c4ed7cb7b75fad166d9dc3 to your computer and use it in GitHub Desktop.
Save oguzcanhuner/9e4b54b819c4ed7cb7b75fad166d9dc3 to your computer and use it in GitHub Desktop.
require 'rails_helper'
RSpec.feature "relink deleted student", type: :feature do
before do
10.times do |i|
create(:plan, student_count: i, stripe_id: i)
end
end
scenario "Mentor relinks a deleted student that they own", js: true do
mentor = create(:mentor, :with_owned_student)
login_as(mentor.user, :scope => :user)
student = mentor.students.last
student.unlink!
mentor.change_plan(student_count: 0)
visit "/mentorships"
within(".unlinked-students") do
click_on "Relink"
end
within(".active-students") do
expect(page).to have_content(student.full_name)
end
mentor.reload
expect(mentor.plan.student_count).to eql 1
end
end
require 'rails_helper'
RSpec.feature "Pausing Students", type: :feature do
before do
@mentor = create(:mentor)
login_as(@mentor.user, :scope => :user)
end
context "As a paying owner" do
scenario "Mentor pauses a student", js: true do
mentorship = create(:mentorship, :owned, mentor: @mentor)
student = mentorship.student
visit "/mentorships"
within(".student") do
click_on "Choose action"
click_on "Pause"
end
within(".student") do
expect(page).to have_content("(paused)")
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment