Sha256: c26e33d90421be47fd2fa75cea734cd06588930e97b803e16b06b478a2292762

Contents?: true

Size: 1.63 KB

Versions: 21

Compression:

Stored size: 1.63 KB

Contents

begin
  config = YAML.load_file("#{Rails.root}/config/api_runner.yml")
rescue
end
namespace :api do
  namespace :run do
    config.each_key do |env|
      desc "runs a series of nessecary api calls and parses their response in environment #{env}"
      task env.to_sym => :environment do
        puts "Running API tests in environment #{env}"
        api_runner = ApiRunner.new(env)
        api_runner.run
        puts "\nTestrun finished\n\n"
      end
    end unless config.nil?
  end
  desc "generates configuration and a skeleton for apirunner tests as well as excludes"
  task :scaffold do
    TEST_EXAMPLES_PATH="test/api_runner"
    CONFIG_EXAMPLE_PATH="config"

    FileUtils.mkdir_p( TEST_EXAMPLES_PATH )
    FileUtils.mkdir_p( CONFIG_EXAMPLE_PATH )
    Dir.glob("#{APIRUNNER_ROOT}/examples/#{TEST_EXAMPLES_PATH}/*.yml").each do |file|
      unless File.exists?("#{TEST_EXAMPLES_PATH}/#{File.basename(file)}")
        FileUtils.cp(file, "#{TEST_EXAMPLES_PATH}") 
        puts "%-50s .... created" % "#{TEST_EXAMPLES_PATH}/#{File.basename(file)}"
      else
        puts "%-50s .... already exists" % "#{TEST_EXAMPLES_PATH}/#{File.basename(file)}"
      end
    end
    Dir.glob("#{APIRUNNER_ROOT}/examples/#{CONFIG_EXAMPLE_PATH}/*.yml").each do |file|
      unless File.exists?("#{CONFIG_EXAMPLE_PATH}/#{File.basename(file)}")
        FileUtils.cp(file, "#{CONFIG_EXAMPLE_PATH}") unless File.exists?("#{CONFIG_EXAMPLE_PATH}/#{File.basename(file)}")
        puts "%-50s .... created" % "#{CONFIG_EXAMPLE_PATH}/#{File.basename(file)}"
      else
        puts "%-50s .... already exists" % "#{CONFIG_EXAMPLE_PATH}/#{File.basename(file)}"
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
apirunner-0.3.5 lib/tasks/api.rake
apirunner-0.3.4 lib/tasks/api.rake
apirunner-0.3.3 lib/tasks/api.rake
apirunner-0.3.2 lib/tasks/api.rake
apirunner-0.3.1 lib/tasks/api.rake
apirunner-0.3.0 lib/tasks/api.rake
apirunner-0.2.8 lib/tasks/api.rake
apirunner-0.2.7 lib/tasks/api.rake
apirunner-0.2.6 lib/tasks/api.rake
apirunner-0.2.5 lib/tasks/api.rake
apirunner-0.2.4 lib/tasks/api.rake
apirunner-0.2.3 lib/tasks/api.rake
apirunner-0.2.2 lib/tasks/api.rake
apirunner-0.2.1 lib/tasks/api.rake
apirunner-0.2.0 lib/tasks/api.rake
apirunner-0.1.11 lib/tasks/api.rake
apirunner-0.1.10 lib/tasks/api.rake
apirunner-0.1.9 lib/tasks/api.rake
apirunner-0.1.8 lib/tasks/api.rake
apirunner-0.1.7 lib/tasks/api.rake