add test because we're awesome

This commit is contained in:
John Bintz 2012-02-08 09:00:33 -05:00
parent ec4a20f3b0
commit 45bf87a97b
3 changed files with 56 additions and 0 deletions

8
spec/spec_helper.rb Normal file
View File

@ -0,0 +1,8 @@
require 'mocha'
require 'fakefs/spec_helpers'
require 'sprockets-vendor_gems'
RSpec.configure do |c|
c.mock_with :mocha
end

View File

@ -0,0 +1,42 @@
require 'spec_helper'
describe Sprockets do
include FakeFS::SpecHelpers
describe '.find_gem_vendor_paths' do
let(:gem_dir) { "dir" }
let(:gemspec) { stub(:gem_dir => gem_dir) }
let(:paths) do
%w{vendor lib app}.collect do |dir|
File.join(gem_dir, dir, 'assets/javascripts')
File.join(gem_dir, dir, 'assets/stylesheets')
end
end
before do
paths.each { |path| FileUtils.mkdir_p path }
Gem::Specification.stubs(:each).yields(gemspec)
end
subject { described_class.find_gem_vendor_paths }
it { should =~ paths }
end
end
describe Sprockets::EnvironmentWithVendoredGems do
let(:env) { described_class.new }
let(:path) { 'path' }
before do
Sprockets.expects(:find_gem_vendor_paths).returns([ path ])
described_class.any_instance.expects(:append_path).with(path)
end
it 'should work' do
env
end
end

View File

@ -14,5 +14,11 @@ Gem::Specification.new do |gem|
gem.version = '0.1.1' gem.version = '0.1.1'
gem.required_rubygems_version = '>= 1.8.0' gem.required_rubygems_version = '>= 1.8.0'
gem.add_dependency 'sprockets'
gem.add_development_dependency 'rspec'
gem.add_development_dependency 'mocha'
gem.add_development_dependency 'fakefs'
end end