Sha256: 80e32a4a35bb6a2aadd7dafc49be40dbb78c51fac9a5e262f2b35bdc56c4a913

Contents?: true

Size: 1.58 KB

Versions: 1

Compression:

Stored size: 1.58 KB

Contents

require 'spec_helper'

class GametelSampleScreen
  include Gametel
end

describe Gametel do

  it "should initialize the platform to Calabash when no other platform is specified" do
    screen = GametelSampleScreen.new
    platform = screen.instance_variable_get(:@platform)
    platform.should be_instance_of ::Gametel::Platforms::Calabash
  end

  it "should add the accessors to the class when included" do
    GametelSampleScreen.should respond_to :text
    GametelSampleScreen.should respond_to :button
  end
  
  context "when using Calabash" do
    let(:screen) { GametelSampleScreen.new }
    let(:platform) { calabash_platform(screen) }
          
    it "should know when a sceen has text" do
      platform.should_receive(:performAction).with('assert_text', 'blah', true).and_return(true)
      screen.has_text? "blah"
    end

    it "should know if a view is enabled" do
      platform.should_receive(:performAction).with('is_enabled', 'some_id').and_return("success" => true)
      screen.should be_enabled('some_id')
    end

    it "should know how to press the back button" do
      platform.should_receive(:performAction).with('go_back')
      screen.back
    end

    it "should know how to press the enter key" do
      platform.should_receive(:performAction).with('send_key_enter')
      screen.enter
    end

    it "should know how to scroll down" do
      platform.should_receive(:performAction).with('scroll_down')
      screen.scroll_down
    end

    it "should know how to scroll up" do
      platform.should_receive(:performAction).with('scroll_up')
      screen.scroll_up
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gametel-0.2 spec/lib/gametel_spec.rb