Sha256: 8049c2050f24178bbabc3427da1dda4e4dec9fd885e81458a5311c204e017552

Contents?: true

Size: 1.64 KB

Versions: 7

Compression:

Stored size: 1.64 KB

Contents

require 'test/unit'
require 'thor'
require 'fileutils'
require 'lesspainful/cli'

class TestParser < Test::Unit::TestCase
  def test_should_raise_if_no_app_or_api_key_is_given
    script = LessPainful::CLI.new([])
    assert_raise Thor::InvocationError do
      script.invoke(:submit)
    end

    script = LessPainful::CLI.new(["test/ipa/2012 Olympics_cal.ipa"])
    assert_raise Thor::InvocationError do
      script.invoke(:submit)
    end


  end

  def test_should_raise_if_app_is_not_file_ipa_or_apk
    script = LessPainful::CLI.new(["test/ipa/NONE_EXIST_2012 Olympics_cal.ipa","JIFZCTPZJJXJLEKMMYRY","."])
    assert_raise RuntimeError do
      script.invoke(:submit)
    end

    script = LessPainful::CLI.new(["test/ipa/features.zip","JIFZCTPZJJXJLEKMMYRY","."])

    assert_raise RuntimeError do
      script.invoke(:submit)
    end
  end

  def test_should_parse_all_configuration_options
    FileUtils.rm_f(File.join("test","vendor"))
    FileUtils.rm_f(File.join("test","Gemfile"))
    FileUtils.rm_f(File.join("test","Gemfile.lock"))

    config_options = {
        :host => "http://localhost:8080",
        :workspace => "test",
        :features => "test/ipa/features.zip",
        :config => "test/config/cucumber.yml",
        :profile => "a",
        "skip-check" => false,
        "reset-between-scenarios" => false,
        "dry-run" => true
    }
    script = LessPainful::CLI.new(["test/ipa/2012 Olympics_cal.ipa","JIFZCTPZJJXJLEKMMYRY"],config_options)


    script.invoke(:submit)

    FileUtils.rm_f(File.join("test","vendor","cache"))
    FileUtils.rm_f(File.join("test","Gemfile"))
    FileUtils.rm_f(File.join("test","Gemfile.lock"))



  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lesspainful-0.10.6 test/test_parser.rb
lesspainful-0.10.5 test/test_parser.rb
lesspainful-0.10.4 test/test_parser.rb
lesspainful-0.10.3 test/test_parser.rb
lesspainful-0.10.2 test/test_parser.rb
lesspainful-0.10.1 test/test_parser.rb
lesspainful-0.10.0 test/test_parser.rb