Sha256: 8897c1d8cef36a6023384694ce9bae89dff60c0db1f01a6247272c5c37202013

Contents?: true

Size: 984 Bytes

Versions: 6

Compression:

Stored size: 984 Bytes

Contents

#---
# Excerpted from "Scripted GUI Testing With Ruby",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material, 
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose. 
# Visit http://www.pragmaticprogrammer.com/titles/idgtr for more book information.
#---
require 'joke_list'

describe JokeList do
  before do
    @list = JokeList.new
  end

  after do
    @list.close
  end

  
  it 'lets me drag an item to the end' do
    @list.order('doctor').should == 2
    @list.move 2, 5
    @list.order('doctor').should == 5
  end
  
  
  
  it 'lets me drag multiple items to sort' do
    original = @list.items

    original.length.downto(1) do |last_pos|
      subset = @list.items[0..last_pos - 1]
      max_pos = subset.index(subset.max) + 1
      @list.move max_pos, last_pos
    end

    @list.items.should == original.sort
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
win_gui-0.1.6 book_code/tubes/list_spec.rb
win_gui-0.1.4 book_code/tubes/list_spec.rb
win_gui-0.1.3 book_code/tubes/list_spec.rb
win_gui-0.1.2 book_code/tubes/list_spec.rb
win_gui-0.1.1 book_code/tubes/list_spec.rb
win_gui-0.1.0 book_code/tubes/list_spec.rb