Sha256: 36bb3a162e0dca8cb10e38533bcf0a34347ce39632507f5b6b6beeaaf49a47dd

Contents?: true

Size: 1.46 KB

Versions: 19

Compression:

Stored size: 1.46 KB

Contents

require "spec_helper"

describe Redcar::Clipboard do
  before do
    @clipboard = Redcar::Clipboard.new("test")
  end
  
  it "accepts new contents" do
    @clipboard << "havelock"
    @clipboard.last.should == ["havelock"]
  end
  
  it "reports its length" do
    @clipboard.length.should == 0
    @clipboard << "havelock"
    @clipboard.length.should == 1
    @clipboard << "havelock2"
    @clipboard.length.should == 2
  end
  
  it "lets you get the items in reverse order" do
    @clipboard << "havelock"
    @clipboard << "samuel"
    @clipboard << "sybil"
    @clipboard[2].should == ["havelock"]
    @clipboard[1].should == ["samuel"]
    @clipboard[0].should == ["sybil"]
  end

  it "loads well when the clipboard starts as blank" do
    cont = "fake controller"
    def cont.changed?; true; end
    def cont.last_set=(something); @a = something;end
    def cont.get_contents; @a; end
    @clipboard.controller = cont
    @clipboard.length.should == 0 # shouldn't blow up
  end
  
  it "should allow for the controller to return contents" do
    cont = "fake controller"
    def cont.changed?; true; end
    def cont.last_set=(something); @a = something;end
    def cont.get_contents; @a; end
    @clipboard.controller = cont
    @clipboard << "yo"
    @clipboard.length.should == 2
  end
  
  it "has a maximum length" do
    (Redcar::Clipboard.max_length + 1).times do |i|
      @clipboard << "foo#{i}"
    end
    @clipboard.length.should == Redcar::Clipboard.max_length
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
redcar-0.13 plugins/application/spec/application/clipboard_spec.rb
redcar-dev-0.13.5dev plugins/application/spec/application/clipboard_spec.rb
redcar-dev-0.13.4dev plugins/application/spec/application/clipboard_spec.rb
redcar-dev-0.13.3dev plugins/application/spec/application/clipboard_spec.rb
redcar-dev-0.13.2dev plugins/application/spec/application/clipboard_spec.rb
redcar-dev-0.13.1dev plugins/application/spec/application/clipboard_spec.rb
redcar-0.12.1 plugins/application/spec/application/clipboard_spec.rb
redcar-dev-0.13.0dev plugins/application/spec/application/clipboard_spec.rb
redcar-0.12 plugins/application/spec/application/clipboard_spec.rb
redcar-dev-0.12.27dev plugins/application/spec/application/clipboard_spec.rb
redcar-dev-0.12.26dev plugins/application/spec/application/clipboard_spec.rb
redcar-dev-0.12.25dev plugins/application/spec/application/clipboard_spec.rb
redcar-dev-0.12.24dev plugins/application/spec/application/clipboard_spec.rb
redcar-dev-0.12.23dev plugins/application/spec/application/clipboard_spec.rb
redcar-dev-0.12.22dev plugins/application/spec/application/clipboard_spec.rb
redcar-dev-0.12.21dev plugins/application/spec/application/clipboard_spec.rb
redcar-dev-0.12.20dev plugins/application/spec/application/clipboard_spec.rb
redcar-dev-0.12.19dev plugins/application/spec/application/clipboard_spec.rb
redcar-dev-0.12.18dev plugins/application/spec/application/clipboard_spec.rb