Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
Fix a broken unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
carsomyr committed May 28, 2015
1 parent e8ae7cb commit d8b8929
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/requirejs-rails_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ def setup
@cfg = Requirejs::Rails::Config.new(Rails.application)
end

def asset_allowed?(asset_path)
!!@cfg.logical_path_patterns.find do |logical_path_pattern|
logical_path_pattern.match(asset_path)
end
end

test "config accepts known loaders" do
@cfg.loader = :almond
assert_equal :almond, @cfg.loader
Expand All @@ -39,10 +45,10 @@ def setup
end

test "matches configured logical assets" do
assert_equal true, @cfg.asset_allowed?('foo.js')
assert_equal false, @cfg.asset_allowed?('bar.frobnitz')
@cfg.logical_path_patterns += [/\.frobnitz$/]
assert_equal true, @cfg.asset_allowed?('bar.frobnitz')
assert_equal true, asset_allowed?("foo.js")
assert_equal false, asset_allowed?("bar.frobnitz")
@cfg.logical_path_patterns.push(Regexp.new("\\.frobnitz\\z"))
assert_equal true, asset_allowed?("bar.frobnitz")
end

test "should have a default empty user_config" do
Expand Down

0 comments on commit d8b8929

Please sign in to comment.