Sha256: ebd93ba7674665d18784d10d1361f801813d3b041bb7671b109736f2c197f2bf

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

require File.dirname(__FILE__) + '/helper'

class MovieTest < Test::Unit::TestCase

  def test_truth
    assert(true)
  end


  def test_instantiate_movie
    assert(Castanaut::Movie.spawn.kind_of?(Castanaut::Movie))
  end


  def test_absolute_mouse_movement
    mov = Castanaut::Movie.spawn

    mov.move(mov.to(100, 100))
    mloc = mov.cursor_location
    assert((99..101).to_a.include?(mloc[:x]))
    assert((99..101).to_a.include?(mloc[:y]))
  end


  def test_relative_mouse_movement
    mov = Castanaut::Movie.spawn

    mloc = mov.cursor_location
    mov.move(mov.by(100, 100))

    new_mloc = mov.cursor_location
    assert_equal(new_mloc[:x], mloc[:x] + 100)
    assert_equal(new_mloc[:y], mloc[:y] + 100)
  end


  def test_plugin_extensibility
    mov = Castanaut::Movie.spawn
    assert(!mov.respond_to?(:to_element))
    mov.plugin('safari')
    assert(mov.respond_to?(:to_element))
  end


  def test_perform_and_skip
    mov = Castanaut::Movie.spawn

    x = 1
    mov.perform("Something") {
      x = 3
      mov.skip(:quiet => true)
      x = 4
    }
    assert_equal(3, x)
  end


  def test_credits
    mov = Castanaut::Movie.spawn
    x = 1
    mov.at_end_of_movie { x = 3 }
    assert_equal(1, x)
    mov.send(:roll_credits)
    assert_equal(3, x)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
castanaut-1.1.2 test/movie_test.rb
castanaut-1.1.1 test/movie_test.rb