spec/beaker/dsl/helpers_spec.rb in beaker-1.12.1 vs spec/beaker/dsl/helpers_spec.rb in beaker-1.12.2

- old
+ new

@@ -14,11 +14,11 @@ let( :opts ) { Beaker::Options::Presets.env_vars } let( :command ) { 'ls' } let( :host ) { double.as_null_object } let( :result ) { Beaker::Result.new( host, command ) } - let( :master ) { make_host( 'master', :roles => %w( master agent ) ) } + let( :master ) { make_host( 'master', :roles => %w( master agent default) ) } let( :agent ) { make_host( 'agent', :roles => %w( agent ) ) } let( :custom ) { make_host( 'custom', :roles => %w( custom agent ) ) } let( :dash ) { make_host( 'console', :roles => %w( dashboard agent ) ) } let( :db ) { make_host( 'db', :roles => %w( database agent ) ) } let( :hosts ) { [ master, agent, dash, db, custom ] } @@ -552,9 +552,36 @@ subject.should_receive( :stub_forge_on ).with( master, nil ).once subject.stub_forge( ) + end + end + + describe 'version_is_less' do + + it 'reports 3.0.0-160-gac44cfb is not less than 3.0.0' do + expect( subject.version_is_less( '3.0.0-160-gac44cfb', '3.0.0' ) ).to be === false + end + + it 'reports 3.0.0-160-gac44cfb is not less than 2.8.2' do + expect( subject.version_is_less( '3.0.0-160-gac44cfb', '2.8.2' ) ).to be === false + end + + it 'reports 3.0.0 is less than 3.0.0-160-gac44cfb' do + expect( subject.version_is_less( '3.0.0', '3.0.0-160-gac44cfb' ) ).to be === true + end + + it 'reports 2.8.2 is less than 3.0.0-160-gac44cfb' do + expect( subject.version_is_less( '2.8.2', '3.0.0-160-gac44cfb' ) ).to be === true + end + + it 'reports 2.8 is less than 3.0.0-160-gac44cfb' do + expect( subject.version_is_less( '2.8', '3.0.0-160-gac44cfb' ) ).to be === true + end + + it 'reports 2.8 is less than 2.9' do + expect( subject.version_is_less( '2.8', '2.9' ) ).to be === true end end describe "#stop_agent_on" do let( :result_fail ) { Beaker::Result.new( [], "" ) }