Sha256: 24d002c92e49d904663ef5bb48ea1f83d630ea9b4ee48ebc42a2cb5fdff86167

Contents?: true

Size: 1.34 KB

Versions: 18

Compression:

Stored size: 1.34 KB

Contents

require File.expand_path('spec/spec_helper')

describe Ruco::StatusBar do
  let(:file){ 'spec/temp.txt' }
  let(:editor){ Ruco::Editor.new(file, :lines => 5, :columns => 35) }
  let(:bar){ Ruco::StatusBar.new(editor, :columns => 35) }

  it "shows name and version" do
    bar.view.should include("Ruco #{Ruco::VERSION}")
  end

  it "shows the file" do
    bar.view.should include(file)
  end

  it "can show to long files" do
    editor = Ruco::Editor.new('123456789abcdefghijklmnop', :lines => 5, :columns => 20)
    bar = Ruco::StatusBar.new(editor, :columns => 30)
    bar.view.should == "Ruco #{Ruco::VERSION} -- 1234...nop   1:1"
    bar.view.size.should == 30
  end

  it "indicates modified" do
    bar.view.should_not include('*')
    editor.insert('x')
    bar.view.should include('*')
  end

  it "indicates writable" do
    bar.view.should_not include('!')
  end

  it "indicates writable if file is missing" do
    editor.stub!(:file).and_return '/gradasadadsds'
    bar.view.should_not include('!')
  end

  it "indicates not writable" do
    # this test will always fail on Windows with cygwin because of how cygwin sets up permissions
    unless RUBY_PLATFORM =~ /mingw/
      editor.stub!(:file).and_return '/etc/sudoers'
      bar.view.should include('!')
    end
  end

  it "shows line and column and right side" do
    bar.view.should =~ /1:1$/
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
ruco-0.2.12 spec/ruco/status_bar_spec.rb
ruco-0.2.11 spec/ruco/status_bar_spec.rb
ruco-0.2.10 spec/ruco/status_bar_spec.rb
ruco-0.2.9 spec/ruco/status_bar_spec.rb
ruco-0.2.8 spec/ruco/status_bar_spec.rb
ruco-0.2.7 spec/ruco/status_bar_spec.rb
ruco-0.2.6 spec/ruco/status_bar_spec.rb
ruco-0.2.5 spec/ruco/status_bar_spec.rb
ruco-0.2.4 spec/ruco/status_bar_spec.rb
ruco-0.2.3 spec/ruco/status_bar_spec.rb
ruco-0.2.2 spec/ruco/status_bar_spec.rb
ruco-0.2.1 spec/ruco/status_bar_spec.rb
ruco-0.2.0 spec/ruco/status_bar_spec.rb
ruco-0.2.0.beta12 spec/ruco/status_bar_spec.rb
ruco-0.2.0.beta11 spec/ruco/status_bar_spec.rb
ruco-0.2.0.beta10 spec/ruco/status_bar_spec.rb
ruco-0.2.0.beta9 spec/ruco/status_bar_spec.rb
ruco-0.1.10 spec/ruco/status_bar_spec.rb