Skip to content

Commit

Permalink
straighten up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fwolfst committed Oct 7, 2020
1 parent ce22d07 commit fa4c61f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
25 changes: 7 additions & 18 deletions test/controllers/pages_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,25 @@ class PagesControllerTest < ActionDispatch::IntegrationTest
assert_response :success
end

test "shows rendered about_us page" do
terms_setting = SiteSetting.find_or_create_by(key: 'about_us',
value: '# about us head',
kind: 'markdown')

get about_us_path

assert_select 'h1', 'about us head'
assert_response :success
end

test "shows rendered term page" do
terms_setting = SiteSetting.find_or_create_by(key: 'terms',
value: '# term-heading',
kind: 'markdown')
terms_setting = SiteSetting.find_or_create_by(key: 'terms')
terms_setting.update!(value: '# term-heading', kind: 'markdown')

get terms_path

assert_select 'h1', 'term-heading'

assert_response :success
end

test "shows rendered privacy statement page" do
terms_setting = SiteSetting.find_or_create_by(key: 'privacy_statement',
value: '# privacy',
kind: 'markdown')
privacy_setting = SiteSetting.find_or_create_by(key: 'privacy_statement')
privacy_setting.update!(value: '## privacy', kind: 'markdown')

get privacy_path

assert_select 'h1', 'privacy'
assert_select 'h2', 'privacy'

assert_response :success
end
end
6 changes: 4 additions & 2 deletions test/helpers/user_access_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

class UserAccessHelperTest < ActionView::TestCase
test "#days_till_end_of_subscription" do
sue = User.create(email: '[email protected]', password: 'password',
password_confirmation: 'password', confirmed_at: DateTime.now)
sue = User.create!(email: '[email protected]', password: 'password',
password_confirmation: 'password',
tos_agreement: true, read_privacy_terms: true,
confirmed_at: DateTime.now)
assert_nil days_till_end_of_subscription(sue)

sue.subscriptions.create(date_start: DateTime.now - 1.hours, date_end: DateTime.now + 4.days)
Expand Down

0 comments on commit fa4c61f

Please sign in to comment.