spec/scripts/script_spec.rb in config_scripts-0.4.2 vs spec/scripts/script_spec.rb in config_scripts-0.4.3

- old
+ new

@@ -10,15 +10,17 @@ end describe "pending_scripts" do let!(:filename1) { "20140208150000_script_1" } let!(:filename2) { "20140208200000_script_2" } + let!(:filename3) { "20140210200000_script_2" } + let!(:filename4) { "20140209200000_script_2" } subject { klass.pending_scripts } before do - Dir.stub glob: ["/tmp/#{filename1}.rb", "/tmp/#{filename2}.rb"] + Dir.stub glob: ["/tmp/#{filename1}.rb", "/tmp/#{filename2}.rb", "/tmp/#{filename3}.rb", "/tmp/#{filename4}.rb"] ConfigScripts::Scripts::ScriptHistory.record_timestamp('20140208150000') end it "uses Dir to get the files" do subject @@ -29,9 +31,14 @@ expect(subject).to include filename2 end it "does not include filenames that have entries in the script history" do expect(subject).not_to include filename1 + end + + it "puts the files in alphabetical order" do + expect(subject.index(filename2)).to be < subject.index(filename4) + expect(subject.index(filename4)).to be < subject.index(filename3) end end describe "run_pending_scripts" do class TestConfigScriptConfig < ConfigScripts::Scripts::Script; end \ No newline at end of file