-
-
Notifications
You must be signed in to change notification settings - Fork 398
/
Copy pathdebug_controller_spec.rb
63 lines (44 loc) · 1.33 KB
/
debug_controller_spec.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# frozen_string_literal: true
RSpec.describe DebugController do
describe "#debug" do
def setup
login_as(create(:user, admin: true))
expect(MigrationStatus)
.to receive(:call)
.and_return(["Migration B - 2", "Migration C - 3"])
end
it "displays an admin settings link" do
setup
get("/admin/debug")
expect(rendered).to have_link("Admin Settings", href: settings_path)
end
it "displays the current Ruby version" do
setup
get "/admin/debug"
expect(rendered).to have_css("dd", text: /#{RUBY_VERSION}/)
end
it "displays the user agent" do
setup
get("/admin/debug", headers: { "HTTP_USER_AGENT" => "testy" })
expect(rendered).to have_css("dd", text: /testy/)
end
it "displays the jobs count" do
setup
12.times { GoodJob::Job.create!(scheduled_at: Time.zone.now) }
get "/admin/debug"
expect(rendered).to have_css("dd", text: /12/)
end
it "displays pending migrations" do
setup
get "/admin/debug"
expect(rendered).to have_css("li", text: /Migration B - 2/)
.and have_css("li", text: /Migration C - 3/)
end
end
describe "#heroku" do
it "displays Heroku instructions" do
get("/heroku")
expect(rendered).to have_text("add an hourly task")
end
end
end