Sha256: ab909d29d512aed52f943ecc49d47eb61176bd3b6868100946728f7a09e01f96
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 KB
Contents
require 'spec_helper' require 'tempfile' describe Gitlab::Shell::History do context 'saving to a file' do before do @file = Tempfile.new('.gitlab_shell_history') @history = Gitlab::Shell::History.new(file_path: @file.path) end after do @file.close(true) end it 'saves the lines' do @history << 'party on, dudes' @history << 'be excellent to each other' @history.save expect(File.read @file.path). to eq("party on, dudes\nbe excellent to each other\n") end it 'has the lines' do @history << 'party on, dudes' @history << 'be excellent to each other' expect(@history.lines). to eq(["party on, dudes", "be excellent to each other"]) end it 'limits the lines to GITLAB_HISTFILESIZE' do ENV['GITLAB_HISTFILESIZE'] = '2' @history << 'bogus' @history << 'party on, dudes' @history << 'be excellent to each other' @history.save expect(@history.lines). to eq(["party on, dudes", "be excellent to each other"]) expect(File.read @file.path). to eq("party on, dudes\nbe excellent to each other\n") end end context 'loading a file' do before do @file = load_fixture('shell_history') @history = Gitlab::Shell::History.new(file_path: @file.path) end it 'has the lines' do @history.load expect(@history.lines). to eq(["party on, dudes", "be excellent to each other"]) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gitlab-3.5.0 | spec/gitlab/shell_history_spec.rb |
gitlab-3.4.0 | spec/gitlab/shell_history_spec.rb |
gitlab-3.3.0 | spec/gitlab/shell_history_spec.rb |