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

Commit

Permalink
Merge pull request #11 from Billiam/feature/increase-coverage
Browse files Browse the repository at this point in the history
Minor bump to test coverage
  • Loading branch information
Kevin Disneur committed Sep 17, 2014
2 parents 79789a1 + 371a1ff commit 0707cbc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/dependency_injection/loaders/test_yaml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,27 @@
require 'dependency_injection/loaders/yaml'

class TestYaml < Minitest::Test
def example_yaml
<<-eos
parameters:
test: <%= 'bar' %>
services:
foo: 'baz'
eos
end

def setup
@container = mock
@yaml_loader = DependencyInjection::Loaders::Yaml.new(@container)
end

def test_loading_file_parsed_as_erb_yaml
IO.expects(:read).with('services.yml').returns(example_yaml)
result = @yaml_loader.send(:load_file, 'services.yml')

assert_equal result, { 'parameters' => { 'test' => 'bar' }, 'services' => {'foo' => 'baz'} }
end

def test_loading_file_without_parameters
@yaml_loader.stubs(:load_file).with('services.yml').returns({ 'services' => [] })
@yaml_loader.expects(:add_parameters).never
Expand Down

0 comments on commit 0707cbc

Please sign in to comment.