Skip to content

Commit

Permalink
Increase test coverage for Lotus::Config::Mapper
Browse files Browse the repository at this point in the history
  • Loading branch information
jodosha committed May 9, 2014
1 parent 0bbc9f3 commit 3f143bd
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
39 changes: 39 additions & 0 deletions test/config/mapper_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
require 'test_helper'

describe Lotus::Config::Mapper do
describe '#to_proc' do
describe 'when only path is given' do
before do
@mapping = Lotus::Config::Mapper.new(path)
end

describe "and it's nil" do
let(:path) { nil }

it 'raises error' do
assert_raises ArgumentError do
@mapping.to_proc
end
end
end

describe "and it points to an unknown file" do
let(:path) { 'unknown/path' }

it 'raises error' do
assert_raises ArgumentError do
@mapping.to_proc
end
end
end

describe "and it points to a valid file" do
let(:path) { __dir__ + '/../fixtures/mapper' }

it 'raises error' do
assert_kind_of Proc, @mapping.to_proc
end
end
end
end
end
1 change: 1 addition & 0 deletions test/fixtures/mapper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts 'hi'

0 comments on commit 3f143bd

Please sign in to comment.