diff options
author | Raphaël Pinson <raphael.pinson@camptocamp.com> | 2013-03-18 03:31:49 -0700 |
---|---|---|
committer | Raphaël Pinson <raphael.pinson@camptocamp.com> | 2013-03-18 03:31:49 -0700 |
commit | 0aa01df4742ac55385e1eb8a0421e2cd1d7ce14f (patch) | |
tree | 37ee4482a666eac29372efe2e788ade2b30d78f6 /spec/hosts/with_lens_spec.rb | |
parent | 8df48d003efcf055b27593091fb981c5c193bc6a (diff) | |
parent | a7c41208cc4a6e9b543487bf606b551307fdc05a (diff) |
Merge pull request #23 from raphink/dev/reorganize
Refactor the module
Diffstat (limited to 'spec/hosts/with_lens_spec.rb')
-rw-r--r-- | spec/hosts/with_lens_spec.rb | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/spec/hosts/with_lens_spec.rb b/spec/hosts/with_lens_spec.rb new file mode 100644 index 0000000..d7a5249 --- /dev/null +++ b/spec/hosts/with_lens_spec.rb @@ -0,0 +1,56 @@ +require 'spec_helper' + +describe 'with_lens' do + let (:facts) { { + :osfamily => 'RedHat', + } } + + context 'when lens_source is passed' do + let (:facts) { { + :osfamily => 'RedHat', + :augeas_lens_source => '/tmp/foo.aug', + } } + + it { should contain_file('/usr/share/augeas/lenses/foo.aug') } + it { should contain_exec('Typecheck lens foo') } + it { should_not contain_file('/usr/share/augeas/lenses/tests/test_foo.aug') } + it { should_not contain_exec('Test lens foo') } + end + + context 'when lens_source and test_source are passed' do + let (:facts) { { + :osfamily => 'RedHat', + :augeas_lens_source => '/tmp/foo.aug', + :augeas_test_source => '/tmp/test_foo.aug', + } } + + it { should contain_file('/usr/share/augeas/lenses/foo.aug') } + it { should contain_exec('Typecheck lens foo') } + it { should contain_file('/usr/share/augeas/lenses/tests/test_foo.aug') } + it { should contain_exec('Test lens foo') } + end + + context 'when stock_since is passed and augeas is older' do + let (:facts) { { + :osfamily => 'RedHat', + :augeas_lens_source => '/tmp/foo.aug', + :augeas_stock_since => '1.2.3', + :augeasversion => '1.0.0', + } } + + it { should contain_file('/usr/share/augeas/lenses/foo.aug') } + it { should contain_exec('Typecheck lens foo') } + end + + context 'when stock_since is passed and augeas is newer' do + let (:facts) { { + :osfamily => 'RedHat', + :augeas_lens_source => '/tmp/foo.aug', + :augeas_stock_since => '1.2.3', + :augeasversion => '1.5.0', + } } + + it { should_not contain_file('/usr/share/augeas/lenses/foo.aug') } + it { should_not contain_exec('Typecheck lens foo') } + end +end |