Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

Commit

Permalink
Fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hawx committed Nov 7, 2014
1 parent 8d74599 commit 7226180
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
11 changes: 7 additions & 4 deletions spec/guard/sass/runner_spec.rb
Expand Up @@ -57,7 +57,6 @@
end

it 'compiles the files' do
a = Guard::Sass::DEFAULTS[:load_paths]
Guard::Sass::DEFAULTS[:load_paths] = ['sass']

mock_engine = mock(::Sass::Engine)
Expand All @@ -68,13 +67,17 @@
:debug_info => false,
:line_numbers => false,
:syntax => :sass,
:filename => 'a.sass'
:filename => 'a.sass',
:all_on_start => false,
:output => "css",
:extension => ".css",
:shallow => false,
:noop => false,
:hide_success => false
}).and_return(mock_engine)
mock_engine.should_receive(:render)

subject.new([watcher], formatter, defaults).run(['a.sass'])

Guard::Sass::DEFAULTS[:load_paths] = a
end

end
Expand Down
19 changes: 11 additions & 8 deletions spec/guard/sass_spec.rb
Expand Up @@ -23,13 +23,16 @@

context 'when options given' do
subject {
Guard::Sass::DEFAULTS[:load_paths] = ['sass']

opts = {
:noop => true,
:hide_success => true,
:style => :compact,
:line_numbers => true
:line_numbers => true,
:watchers => []
}
Guard::Sass.new([], opts)
Guard::Sass.new(opts)
}

it 'merges them with defaults' do
Expand All @@ -43,13 +46,13 @@
:noop => true,
:hide_success => true,
:line_numbers => true,
:load_paths => ::Sass::Plugin.template_location_array.map(&:first)
:load_paths => ['sass']
}
end
end

context 'with an :input option' do
subject { Guard::Sass.new([], {:input => 'app/styles'}) }
subject { Guard::Sass.new(watchers: [], input: 'app/styles') }

it 'creates a watcher' do
subject.should have(1).watchers
Expand All @@ -66,7 +69,7 @@
end

context 'with an output option' do
subject { Guard::Sass.new([], {:input => 'app/styles', :output => 'public/styles'}) }
subject { Guard::Sass.new(input: 'app/styles', output: 'public/styles', watchers: []) }

it 'uses the output directory' do
subject.options[:output].should == 'public/styles'
Expand All @@ -83,7 +86,7 @@
end

context ':all_on_start option is true' do
subject { Guard::Sass.new [], :all_on_start => true }
subject { Guard::Sass.new(watchers: [], all_on_start: true) }

it 'calls #run_all' do
subject.should_receive(:run_all)
Expand All @@ -93,7 +96,7 @@
end

describe '#run_all' do
subject { Guard::Sass.new([Guard::Watcher.new('(.*)\.s[ac]ss')]) }
subject { Guard::Sass.new(watchers: [Guard::Watcher.new('(.*)\.s[ac]ss')]) }

before do
Dir.stub(:[]).and_return ['a.sass', 'b.scss', 'c.ccss', 'd.css', 'e.scsc']
Expand All @@ -106,7 +109,7 @@
end

describe '#run_on_changes' do
subject { Guard::Sass.new([Guard::Watcher.new('(.*)\.s[ac]ss')]) }
subject { Guard::Sass.new(watchers: [Guard::Watcher.new('(.*)\.s[ac]ss')]) }

context 'if paths given contain partials' do
it 'calls #run_all' do
Expand Down

0 comments on commit 7226180

Please sign in to comment.