Enrolment cucumber-like rspec feature spec
feature 'Enrolment' do | |
scenario 'Enrolling in a course' do | |
given_there_is_a_course | |
and_i_am_logged_in_as_a_learner | |
when_i_enrol_on_a_course | |
then_the_course_should_appear_in_my_courses | |
end | |
def given_there_is_a_course | |
@course = FactoryGirl.create(:course) | |
end | |
def and_i_am_logged_in_as_a_learner | |
@learner = FactoryGirl.create(:learner) | |
login_as @learner | |
end | |
def when_i_enrol_on_a_course | |
visit course_path(@course) | |
find('.join').click | |
expect(page).to have_content('Thanks for joining!') | |
end | |
def then_the_course_should_appear_in_my_courses | |
visit '/' | |
expect(page).to have_main_header('My Courses') | |
expect(page).to have_content(@course.full_title) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
I love this.