Skip to content

Commit

Permalink
Adding unit test for the new "views.rb" file
Browse files Browse the repository at this point in the history
  • Loading branch information
wenderjean committed Jan 10, 2021
1 parent 167cce7 commit 5d57779
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/statistic/views_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

require 'minitest_helper'

describe Sidekiq::Statistic::Views do
before do
@views = Sidekiq::Statistic::Views
end

describe '.require_assets' do
it 'returns content if file exists' do
content = @views.require_assets('styles/common.css').first

_(content).must_match(/=== COMMON ===/)
end

it 'raises an error if file does not exist' do
assert_raises Errno::ENOENT do
@views.require_assets('styles/abc.css')
end
end
end
end

0 comments on commit 5d57779

Please sign in to comment.