Permalink
Browse files

Fixed specs: They now pass!

  • Loading branch information...
1 parent 08fb83c commit 2612cdd247a2de14b1f3dda8d4278abb71ae9c20 @hawx committed Mar 22, 2013
Showing with 14 additions and 10 deletions.
  1. +1 −1 lib/guard/sass/runner.rb
  2. +11 −8 spec/guard/sass/runner_spec.rb
  3. +2 −1 spec/guard/sass_spec.rb
View
@@ -20,7 +20,7 @@ def initialize(watchers, formatter, options={})
# @param files [Array<String>]
# @return [Array<Array,Boolean>]
def run(files)
- changed_files, errors = compile_files(files)
+ changed_files, errors = compile_files(files)
[changed_files, errors.empty?]
end
@@ -5,7 +5,7 @@
subject { Guard::Sass::Runner }
let(:watcher) { Guard::Watcher.new('^(.*)\.s[ac]ss$') }
- let(:formatter) { subject.instance_variable_get(:@formatter) }
+ let(:formatter) { Guard::Sass::Formatter.new }
let(:defaults) { Guard::Sass::DEFAULTS }
before do
@@ -19,11 +19,11 @@
describe '#run' do
it 'returns a list of changed files' do
- subject.new([watcher], defaults).run(['a.sass'])[0].should == ['css/a.css']
+ subject.new([watcher], formatter, defaults).run(['a.sass'])[0].should == ['css/a.css']
end
context 'if errors when compiling' do
- subject { Guard::Sass::Runner.new([watcher], defaults) }
+ subject { Guard::Sass::Runner.new([watcher], formatter, defaults) }
before do
$_stderr, $stderr = $stderr, StringIO.new
@@ -45,7 +45,7 @@
end
context 'if no errors when compiling' do
- subject { Guard::Sass::Runner.new([watcher], defaults) }
+ subject { Guard::Sass::Runner.new([watcher], formatter, defaults) }
it 'shows a success message' do
formatter.should_receive(:success).with("a.sass -> a.css", instance_of(Hash))
@@ -63,13 +63,16 @@
mock_engine = mock(::Sass::Engine)
::Sass::Engine.should_receive(:new).with('', {
- :syntax => :sass, :load_paths => ['sass'],
- :style => :nested, :debug_info => false,
- :line_numbers => false
+ :load_paths => ['sass'],
+ :style => :nested,
+ :debug_info => false,
+ :line_numbers => false,
+ :syntax => :sass,
+ :filename => "a.sass"
}).and_return(mock_engine)
mock_engine.should_receive(:render)
- subject.new([watcher], defaults).run(['a.sass'])
+ subject.new([watcher], formatter, defaults).run(['a.sass'])
Guard::Sass::DEFAULTS[:load_paths] = a
end
View
@@ -4,7 +4,8 @@
subject { ::Guard::Sass.new }
- let(:runner) { Guard::Sass::Runner.new([]) }
+ let(:formatter) { Guard::Sass::Formatter.new }
+ let(:runner) { Guard::Sass::Runner.new([], formatter) }
before do
subject.instance_variable_set :@runner, runner

0 comments on commit 2612cdd

Please sign in to comment.