forked from mendicant-original/liskov
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_helper.rb
38 lines (30 loc) · 912 Bytes
/
test_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require "capybara/rails"
Clubhouse::Client.test_mode = true
def clubhouse_person(github_nickname)
# FIXME: duplicates code from ApplicationController
PersonDecorator.new(Clubhouse::Client::Person.new(github_nickname))
end
class ActiveSupport::TestCase
fixtures :all
end
class ActionDispatch::IntegrationTest
include Capybara::DSL
teardown { Capybara.reset_sessions! }
def sign_in_as_instructor
sign_in clubhouse_person('instructor')
end
def sign_in_as_student
sign_in clubhouse_person('student')
end
def sign_in(person)
visit root_url
fill_in("Name", with: person.name)
fill_in("Email", with: person.email)
fill_in("Nickname", with: person.github_nickname)
click_button "Sign In"
assert_includes(page.body, "Welcome to Liskov")
end
end