Skip to content

Commit

Permalink
First rspec test...
Browse files Browse the repository at this point in the history
  • Loading branch information
hugopl committed Aug 3, 2015
1 parent 31c5fb3 commit 9f4661b
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .rspec
@@ -0,0 +1,2 @@
--color
--require spec_helper
1 change: 1 addition & 0 deletions hiera-redis.gemspec
Expand Up @@ -13,6 +13,7 @@ Gem::Specification.new do |s|
s.license = 'GPL-3'
s.add_dependency 'hiera', '>= 1.0'
s.add_dependency 'redis', '>= 3.2'
s.add_development_dependency 'rspec', '~> 3.3'
s.files = Dir['lib/**/*.rb']
s.files += ['COPYING']
end
4 changes: 4 additions & 0 deletions spec/hiera.yaml
@@ -0,0 +1,4 @@
:backends:
- redis
:redis:
:port: 234
21 changes: 21 additions & 0 deletions spec/hiera_redis_spec.rb
@@ -0,0 +1,21 @@
require 'hiera'
require 'redis'

describe 'hiera-redis' do
let(:hiera) do
Hiera.new(config: {
default: nil,
backends: ['redis'],
scope: {},
key: nil,
verbose: false,
resolution_type: :priority,
format: :ruby })
end
let(:redis) { Redis.new }

it 'works' do
redis.set('common:foo', 'bar')
expect(hiera.lookup('foo', '', '')).to eq('bar')
end
end
16 changes: 16 additions & 0 deletions spec/spec_helper.rb
@@ -0,0 +1,16 @@
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end

config.mock_with :rspec do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end

config.warnings = true
config.order = :random
Kernel.srand config.seed
end

0 comments on commit 9f4661b

Please sign in to comment.