spec/lib/interpolate_spec.rb in hieracles-0.3.2 vs spec/lib/interpolate_spec.rb in hieracles-0.3.3
- old
+ new
@@ -41,9 +41,27 @@
it { expect(parse data, values, true).to eq expected }
end
end
end
+ describe '.extract' do
+ context 'with a single var' do
+ let(:data) { 'something_%{a_var}' }
+ let(:expected) { [ 'a_var' ] }
+ it { expect(extract data).to eq expected }
+ end
+ context 'with a 2 vars' do
+ let(:data) { "something_%{a_var}\nanother %{one}" }
+ let(:expected) { [ 'a_var', 'one' ] }
+ it { expect(extract data).to eq expected }
+ end
+ context 'with a 2 identical vars' do
+ let(:data) { "something_%{a_var}\nanother %{a_var}" }
+ let(:expected) { [ 'a_var' ] }
+ it { expect(extract data).to eq expected }
+ end
+ end
+
describe ".ask_about" do
end
end