Skip to content

Commit 665f130

Browse files
committed
Test fixes
1 parent 18a7bee commit 665f130

File tree

9 files changed

+27
-5
lines changed

9 files changed

+27
-5
lines changed

app/models/available_point.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,13 @@ def self.course_sheet_points_list(course, sheet)
8181
end
8282

8383
def award_to(user, submission = nil)
84+
point_awarded_at = submission ? submission.created_at : Time.zone.now
8485
AwardedPoint.create!(
8586
course_id: exercise.course_id,
8687
name: name,
8788
user_id: user.id,
8889
submission: submission,
89-
created_at: submission.created_at
90+
created_at: point_awarded_at
9091
)
9192
rescue ActiveRecord::RecordNotUnique
9293
end

bin/spec_controllers

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
RSPEC_PATTERN="spec/controllers/*.rb,spec/controllers/setup/*.rb"
4+
bundle exec rake spec SPEC_OPTS="--pattern $RSPEC_PATTERN --format documentation"

bin/spec_features

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
RSPEC_PATTERN="spec/features/**/*.rb"
3+
bundle exec rake spec SPEC_OPTS="--pattern $RSPEC_PATTERN --format documentation"

bin/spec_integration

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
RSPEC_PATTERN="spec/integration/**/*.rb"
4+
bundle exec rake spec SPEC_OPTS="--pattern $RSPEC_PATTERN --format documentation"

bin/spec_lib

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
RSPEC_PATTERN="spec/lib/**/*.rb"
4+
bundle exec rake spec SPEC_OPTS="--pattern $RSPEC_PATTERN --format documentation"

bin/spec_models

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
RSPEC_PATTERN="spec/models/**/*.rb"
4+
bundle exec rake spec SPEC_OPTS="--pattern $RSPEC_PATTERN --format documentation"

spec/controllers/setup/organizations_controller_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{
1313
name: 'TestOrganization',
1414
slug: 'test-organization',
15-
verified: true
15+
verified: true,
1616
}
1717
end
1818

@@ -28,7 +28,7 @@
2828
{
2929
name: 'New organization name',
3030
information: 'New information',
31-
website: 'http://newurl.net/'
31+
website: 'http://newurl.net/',
3232
}
3333
end
3434

spec/spec_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def host_ip
7777
config.before(:each) do |context|
7878
allow(Tailoring).to receive_messages(get: Tailoring.new)
7979
SiteSetting.use_distribution_defaults!
80+
SiteSetting.all_settings['administrative_email'] = '[email protected]'
8081

8182
if context.metadata[:integration] || context.metadata[:feature]
8283
# integration tests can't use transaction since the webserver must see the changes

spec/support/integration_test_actions.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ module IntegrationTestActions
66
include SystemCommands
77

88
def log_in_as(username, password)
9-
fill_in 'session_login', with: username
10-
fill_in 'session_password', with: password
9+
visit 'login'
10+
fill_in 'username', with: username
11+
fill_in 'password', with: password
1112
click_button 'Sign in'
1213

1314
expect(page).to have_content('Sign out')

0 commit comments

Comments
 (0)