Sha256: 957e2f7560bb788619905310e2398d39b22d238e8bf6dfac9a4420e0eeac362e
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
require "lita-enhance" require "lita/rspec" require 'pry' RSpec.shared_context 'mocks' do include_context 'redis' def spec_data(file_name) File.read(File.expand_path("../data/#{file_name}", __FILE__)) end let(:west2_chef_node) do chef_nodes.detect {|n| n.name == 'box01' } end let(:west1_chef_node) do chef_nodes.detect {|n| n.name == 'box02' } end let(:linode_chef_node) do chef_nodes.detect {|n| n.name == 'box03' } end let(:chef_nodes) do Dir['spec/data/*.json'].map do |node_json| Chef::Node.json_create(JSON.parse(IO.read(node_json))) end end let(:nodes) do chef_indexer = Lita::Handlers::Enhance::ChefIndexer.new(redis, {}) chef_nodes.map do |chef_node| node = chef_indexer.node_from_chef_node(chef_node) node.store!(redis) node end end let(:nodes_and_chef_nodes) do nodes.zip(chef_nodes) end end RSpec.shared_context 'redis' do let(:redis) { Redis.new } before do redis.flushdb end end RSpec.shared_context 'indexed' do include_context 'mocks' include_context 'redis' let(:chef_indexer) { Lita::Handlers::Enhance::ChefIndexer.new(redis, {}) } before do chef_nodes.each do |chef_node| chef_indexer.index_chef_node(chef_node) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lita-enhance-0.9.2 | spec/spec_helper.rb |
lita-enhance-0.9.1 | spec/spec_helper.rb |
lita-enhance-0.9.0 | spec/spec_helper.rb |