Skip to content

Commit

Permalink
Adds test
Browse files Browse the repository at this point in the history
  • Loading branch information
jchayan committed Sep 12, 2020
1 parent 63c9fe2 commit 6797989
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
2 changes: 0 additions & 2 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true

config.allow_concurrency = true

# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
Expand Down
18 changes: 18 additions & 0 deletions spec/controllers/ovens_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,22 @@
end

end

describe 'GET progress' do
context "when not authenticated" do
before { sign_in nil }

it "blocks access" do
the_request
expect(response).to redirect_to new_user_session_path
end
end

context "when authenticated" do
before { get :progress }
it { expect(response.headers['Content-Type']).to eq("text/event-stream") }
after {response.stream.close unless response.stream.closed? }
end
end

end
20 changes: 20 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,23 @@
end
=end
end

# Trying to debug what's wrong with RSpec and ActionController::Live
# puts "rspec pid: #{Process.pid}"
#
# trap 'USR1' do
# threads = Thread.list
#
# puts
# puts "=" * 80
# puts "Received USR1 signal; printing all #{threads.count} thread backtraces."
#
# threads.each do |thr|
# description = thr == Thread.main ? "Main thread" : thr.inspect
# puts
# puts "#{description} backtrace: "
# puts thr.backtrace.join("\n")
# end
#
# puts "=" * 80
# end

0 comments on commit 6797989

Please sign in to comment.