2011-12-05 23:49:52 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Jasmine::Headless::FileChecker do
|
|
|
|
let(:test_class) do
|
|
|
|
object = Object.new
|
|
|
|
object.class.send(:include, Jasmine::Headless::FileChecker)
|
|
|
|
object
|
|
|
|
end
|
2011-12-06 14:31:23 +00:00
|
|
|
|
2012-01-11 13:44:28 +00:00
|
|
|
describe "#bad_format?" do
|
|
|
|
subject { test_class.bad_format?(file) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
test_class.stubs(:excluded_formats).returns(%w{erb string})
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'nil' do
|
|
|
|
let(:file) { nil }
|
|
|
|
|
|
|
|
it { should be_nil }
|
2011-12-05 23:49:52 +00:00
|
|
|
end
|
2011-12-06 14:31:23 +00:00
|
|
|
|
2012-01-11 13:44:28 +00:00
|
|
|
context 'allowed format' do
|
|
|
|
let(:file) { 'foobar.js' }
|
|
|
|
|
|
|
|
it { should be_false }
|
2011-12-05 23:49:52 +00:00
|
|
|
end
|
|
|
|
|
2012-01-11 13:44:28 +00:00
|
|
|
context 'unallowed format' do
|
|
|
|
let(:file) { 'foobar.erb' }
|
|
|
|
|
|
|
|
it { should be_true }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'check whole extension' do
|
|
|
|
let(:file) { 'foobar.string.js' }
|
|
|
|
|
|
|
|
it { should be_true }
|
2011-12-06 14:31:23 +00:00
|
|
|
end
|
|
|
|
end
|
2011-12-05 23:49:52 +00:00
|
|
|
end
|