flexunit 0.0.3.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +9 -0
- data/Gemfile.lock +25 -0
- data/POSTINSTALL.rdoc +25 -0
- data/README.md +77 -0
- data/Rakefile +20 -0
- data/bin/fu-as3 +8 -0
- data/bin/fu-flex +8 -0
- data/bin/fu-runner +8 -0
- data/flexunit.gemspec +22 -0
- data/lib/flexunit.rb +38 -0
- data/lib/flexunit4/generators/flex_project_generator.rb +4 -0
- data/lib/flexunit4/generators/project_generator.rb +25 -0
- data/lib/flexunit4/generators/runner_generator.rb +9 -0
- data/lib/flexunit4/generators/suite_class_generator.rb +17 -0
- data/lib/flexunit4/generators/templates/ActionScript3Class.as +10 -0
- data/lib/flexunit4/generators/templates/ActionScript3MainClass.as +14 -0
- data/lib/flexunit4/generators/templates/ActionScript3RunnerClass.as +21 -0
- data/lib/flexunit4/generators/templates/Flex4Application.mxml +45 -0
- data/lib/flexunit4/generators/templates/Flex4Main.css +7 -0
- data/lib/flexunit4/generators/templates/Flex4Rakefile.rb +33 -0
- data/lib/flexunit4/generators/templates/Flex4RunnerClass.mxml +28 -0
- data/lib/flexunit4/generators/templates/FlexUnit4SuiteClass.as +23 -0
- data/lib/flexunit4/generators/templates/FlexUnit4TestClass.as +30 -0
- data/lib/flexunit4/generators/templates/Gemfile +4 -0
- data/lib/flexunit4/generators/templates/Rakefile +76 -0
- data/lib/flexunit4/generators/test_class_generator.rb +14 -0
- data/test/unit/test_class_generator_test.rb +50 -0
- data/test/unit/test_helper.rb +18 -0
- data/test/unit/test_project_generator_test.rb +12 -0
- metadata +88 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
archive-tar-minitar (0.5.2)
|
5
|
+
flashsdk (1.0.26.pre)
|
6
|
+
sprout (>= 1.1.11.pre)
|
7
|
+
mocha (0.9.12)
|
8
|
+
open4 (1.0.1)
|
9
|
+
rake (0.8.7)
|
10
|
+
rubyzip (0.9.4)
|
11
|
+
shoulda (2.11.3)
|
12
|
+
sprout (1.1.11.pre)
|
13
|
+
archive-tar-minitar (= 0.5.2)
|
14
|
+
bundler (>= 0.9.19)
|
15
|
+
open4 (>= 0.9.6)
|
16
|
+
rake (>= 0.8.7)
|
17
|
+
rubyzip (= 0.9.4)
|
18
|
+
|
19
|
+
PLATFORMS
|
20
|
+
ruby
|
21
|
+
|
22
|
+
DEPENDENCIES
|
23
|
+
flashsdk (>= 1.0.2.pre)
|
24
|
+
mocha
|
25
|
+
shoulda
|
data/POSTINSTALL.rdoc
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
++++++++++++++++++++++++++++++++
|
2
|
+
You have successfully installed Project Sprouts support for FlexUnit!
|
3
|
+
|
4
|
+
Example usage:
|
5
|
+
|
6
|
+
# Generate a ActionScript 3 project named 'SomeProject'
|
7
|
+
fu-as3 SomeProject
|
8
|
+
|
9
|
+
# Generate a Flex project named 'SomeFlexProject'
|
10
|
+
fu-flex SomeFlexProject
|
11
|
+
|
12
|
+
# Generate a new class, test case and test suite:
|
13
|
+
sprout-class utils.MathUtil
|
14
|
+
|
15
|
+
# Compile and run the test harness:
|
16
|
+
rake test
|
17
|
+
|
18
|
+
# List available rake tasks:
|
19
|
+
rake -T
|
20
|
+
|
21
|
+
# List available generators:
|
22
|
+
sprout-
|
23
|
+
# or:
|
24
|
+
fu-
|
25
|
+
(followed by the TAB key)
|
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Project Sprouts FlexUnit 4.x Gem _ALPHA_
|
2
|
+
|
3
|
+
This [RubyGem](http://docs.rubygems.org/read/book/7) contains templates and
|
4
|
+
libraries to add support for [FlexUnit](http://flexunit.org) in
|
5
|
+
[Project Sprouts](http://projectsprouts.org). In it's current state it's only
|
6
|
+
reliable function is to provide sprout-class generator support, see the TODO's
|
7
|
+
below.
|
8
|
+
|
9
|
+
## Install
|
10
|
+
|
11
|
+
git clone [this repo]
|
12
|
+
cd sprout-flexunit
|
13
|
+
bundle install
|
14
|
+
gem build flexunit.gemspec
|
15
|
+
gem install flexunit
|
16
|
+
|
17
|
+
#### Or
|
18
|
+
|
19
|
+
gem install flexunit --pre
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Generate a project with
|
24
|
+
|
25
|
+
fu-as3 TestProject
|
26
|
+
|
27
|
+
Or edit your Gemfile to include
|
28
|
+
|
29
|
+
gem "flexunit", ">= 0.0.3.pre"
|
30
|
+
|
31
|
+
This will mean that when you generate a class using:
|
32
|
+
|
33
|
+
sprout-class JamJar
|
34
|
+
|
35
|
+
The associated FlexUnit test case will automatically be created.
|
36
|
+
|
37
|
+
To build (when the swc's link as expected) the following Rake file edits may be
|
38
|
+
needed:
|
39
|
+
|
40
|
+
* Replace `:asunit` references with `:flexunit4`.
|
41
|
+
* Manually convert the TestRunner.mxml to use your choice of FlexUnit runners.
|
42
|
+
* Switch the test task to use `amxmlc` in the Rake file (if appropriate).
|
43
|
+
|
44
|
+
## TODO
|
45
|
+
|
46
|
+
* SWC library linkage
|
47
|
+
* Project Templates for AS3, Flex, & AIR
|
48
|
+
* Runner Templates for AS3, Flex, & AIR
|
49
|
+
* Rake examples
|
50
|
+
|
51
|
+
## Credit
|
52
|
+
|
53
|
+
To Luke Bayes and Kristopher Joseph as similarity to the FlashSDK and Robotlegs
|
54
|
+
srpout gems are not purely coincidental.
|
55
|
+
|
56
|
+
## MIT License
|
57
|
+
|
58
|
+
Copyright (c) 2011 Simon Gregory
|
59
|
+
|
60
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
61
|
+
a copy of this software and associated documentation files (the
|
62
|
+
'Software'), to deal in the Software without restriction, including
|
63
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
64
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
65
|
+
permit persons to whom the Software is furnished to do so, subject to
|
66
|
+
the following conditions:
|
67
|
+
|
68
|
+
The above copyright notice and this permission notice shall be
|
69
|
+
included in all copies or substantial portions of the Software.
|
70
|
+
|
71
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
72
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
73
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
74
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
75
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
76
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
77
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
|
4
|
+
Bundler.require
|
5
|
+
|
6
|
+
require 'rake'
|
7
|
+
require 'rake/clean'
|
8
|
+
require 'rake/testtask'
|
9
|
+
|
10
|
+
require File.join(File.dirname(__FILE__), 'lib', 'flexunit')
|
11
|
+
|
12
|
+
Rake::TestTask.new(:test) do |t|
|
13
|
+
t.libs << "test/unit"
|
14
|
+
t.test_files = FileList["test/unit/*_test.rb"]
|
15
|
+
t.verbose = true
|
16
|
+
end
|
17
|
+
|
18
|
+
CLEAN.add '*.gem'
|
19
|
+
|
20
|
+
task :default => :test
|
data/bin/fu-as3
ADDED
data/bin/fu-flex
ADDED
data/bin/fu-runner
ADDED
data/flexunit.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), 'lib', 'flexunit')
|
4
|
+
require 'rake'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = FlexUnit::NAME
|
8
|
+
s.version = FlexUnit::VERSION
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.authors = ["Simon Gregory"]
|
11
|
+
s.email = ["projectsprouts@googlegroups.com"]
|
12
|
+
s.homepage = "http://projectsprouts.org"
|
13
|
+
s.summary = "FlexUnit is a unit testing framework for Flex and ActionScript 3.0 applications and libraries."
|
14
|
+
s.description = "FlexUnit 4 is meta-data driven allowing you to have extreme freedom and ease when creating tests."
|
15
|
+
s.executables = ["fu-flex", "fu-as3", "fu-runner"]
|
16
|
+
s.post_install_message = File.read 'POSTINSTALL.rdoc'
|
17
|
+
s.rubyforge_project = "flexunit"
|
18
|
+
s.required_rubygems_version = ">= 1.3.7"
|
19
|
+
s.require_path = "lib"
|
20
|
+
s.files = FileList["**/*"].exclude /docs|.DS_Store|generated|.svn|.git|airglobal.swc|airframework.swc/
|
21
|
+
end
|
22
|
+
|
data/lib/flexunit.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'flashsdk'
|
2
|
+
|
3
|
+
$:.unshift File.dirname(__FILE__)
|
4
|
+
|
5
|
+
module FlexUnit
|
6
|
+
NAME = 'flexunit'
|
7
|
+
VERSION = '0.0.3.pre'
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'flexunit4/generators/flex_project_generator'
|
11
|
+
require 'flexunit4/generators/project_generator'
|
12
|
+
require 'flexunit4/generators/runner_generator'
|
13
|
+
require 'flexunit4/generators/suite_class_generator'
|
14
|
+
require 'flexunit4/generators/test_class_generator'
|
15
|
+
|
16
|
+
Sprout::Specification.new do |s|
|
17
|
+
s.name = FlexUnit::NAME
|
18
|
+
s.version = FlexUnit::VERSION
|
19
|
+
|
20
|
+
s.add_remote_file_target do |t|
|
21
|
+
t.platform = :universal
|
22
|
+
t.archive_type = :zip
|
23
|
+
t.url = "http://flexunit.org/releases/flexunit-4.1.0-8-4.1.0.16076.zip"
|
24
|
+
t.md5 = "11b355d269be39c03e24aa1143ef4c1c"
|
25
|
+
|
26
|
+
# Picks the full contents of the zip up and moves it to the lib...
|
27
|
+
# t.add_library :swc, ['flexunit/']
|
28
|
+
|
29
|
+
# Only moves the first ??
|
30
|
+
t.add_library :flexunit_as3, "flexunit/flexunit-4.1.0-8-as3_4.1.0.16076.swc"
|
31
|
+
t.add_library :flexunit_flex, "flexunit/flexunit-4.1.0-8-flex_4.1.0.16076.swc"
|
32
|
+
t.add_library :flexunit_aircilistener, "flexunit/flexunit-aircilistener-4.1.0-8-4.1.0.16076.swc"
|
33
|
+
t.add_library :flexunit_cilistener, "flexunit/flexunit-cilistener-4.1.0-8-4.1.0.16076.swc"
|
34
|
+
t.add_library :flexunit_flexcoverlistener, "flexunit/flexunit-flexcoverlistener-4.1.0-8-4.1.0.16076.swc"
|
35
|
+
t.add_library :flexunit_uilistener, "flexunit/flexunit-uilistener-4.1.0-8-4.1.0.16076.swc"
|
36
|
+
t.add_library :flexunit_extensions, "flexunit/fluint-extensions-4.1.0-8-4.1.0.16076.swc"
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module FlexUnit4
|
2
|
+
class ProjectGenerator < FlashSDK::ClassGenerator
|
3
|
+
|
4
|
+
add_param :css, Path, { :default => 'css' }
|
5
|
+
add_param :images, Path, { :default => 'images' }
|
6
|
+
add_param :fonts, Path, { :default => 'fonts' }
|
7
|
+
|
8
|
+
def manifest
|
9
|
+
directory input do
|
10
|
+
template 'Rakefile'
|
11
|
+
template 'Gemfile'
|
12
|
+
|
13
|
+
directory src do
|
14
|
+
template "#{input.camel_case}.as", 'ActionScript3MainClass.as'
|
15
|
+
template "#{test_runner_name}.as", 'ActionScript3RunnerClass.as'
|
16
|
+
end
|
17
|
+
|
18
|
+
# Create empty directories:
|
19
|
+
directory lib
|
20
|
+
directory bin
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module FlexUnit4
|
2
|
+
class SuiteClassGenerator < FlashSDK::ClassGenerator
|
3
|
+
include FlashSDK::FlashHelper
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
super
|
7
|
+
self.input = 'AllTests.as'
|
8
|
+
end
|
9
|
+
|
10
|
+
def manifest
|
11
|
+
directory test do
|
12
|
+
template input, 'FlexUnit4SuiteClass.as'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
package
|
2
|
+
{
|
3
|
+
|
4
|
+
import flash.display.Sprite;
|
5
|
+
|
6
|
+
import org.flexunit.internals.TraceListener;
|
7
|
+
import org.flexunit.runner.FlexUnitCore;
|
8
|
+
|
9
|
+
public class <%= test_runner_name %> extends Sprite
|
10
|
+
{
|
11
|
+
private var core:FlexUnitCore;
|
12
|
+
|
13
|
+
public function <%= test_runner_name %>()
|
14
|
+
{
|
15
|
+
core = new FlexUnitCore();
|
16
|
+
core.addListener( new TraceListener() );
|
17
|
+
core.run( AllTests );
|
18
|
+
}
|
19
|
+
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
|
2
|
+
xmlns:s="library://ns.adobe.com/flex/spark"
|
3
|
+
xmlns:mx="library://ns.adobe.com/flex/mx"
|
4
|
+
minWidth="800"
|
5
|
+
minHeight="600"
|
6
|
+
width="1024"
|
7
|
+
height="768"
|
8
|
+
pageTitle="<%= project_name %>"
|
9
|
+
applicationComplete="<%= project_name %>CompleteHandler()">
|
10
|
+
|
11
|
+
<fx:Declarations>
|
12
|
+
|
13
|
+
<!-- You have to put all non-visual object declarations here -->
|
14
|
+
|
15
|
+
</fx:Declarations>
|
16
|
+
|
17
|
+
<s:Label id="myLabel"
|
18
|
+
text="<%= project_name %>"
|
19
|
+
width="100%"
|
20
|
+
height="100%"
|
21
|
+
fontSize="200" />
|
22
|
+
|
23
|
+
<fx:Style source="./assets/css/Main.css" />
|
24
|
+
|
25
|
+
<fx:Script>
|
26
|
+
|
27
|
+
<![CDATA[
|
28
|
+
|
29
|
+
//---------------------------------------
|
30
|
+
// PRIVATE METHODS
|
31
|
+
//---------------------------------------
|
32
|
+
|
33
|
+
/**
|
34
|
+
* @private
|
35
|
+
*/
|
36
|
+
private function <%= project_name %>CompleteHandler():void
|
37
|
+
{
|
38
|
+
trace("<%= project_name %>.mxml::<%= project_name %>CompleteHandler()");
|
39
|
+
}
|
40
|
+
]]>
|
41
|
+
|
42
|
+
</fx:Script>
|
43
|
+
|
44
|
+
</s:Application>
|
45
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
Bundler.require
|
4
|
+
|
5
|
+
##############################
|
6
|
+
# Debug
|
7
|
+
|
8
|
+
# Compile the debug swf
|
9
|
+
mxmlc "<%= bin %>/<%= debug_swf_name %>" do |t|
|
10
|
+
t.input = "<%= src %>/<%= class_name %>.mxml"
|
11
|
+
t.debug = true
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "Compile and run the debug swf"
|
15
|
+
flashplayer :debug => "<%= bin %>/<%= debug_swf_name %>"
|
16
|
+
|
17
|
+
##############################
|
18
|
+
# Test
|
19
|
+
|
20
|
+
library :flexunit
|
21
|
+
|
22
|
+
# Compile the test swf
|
23
|
+
mxmlc "<%= bin %>/<%= test_swf_name %>" => :flexunit do |t|
|
24
|
+
t.input = "<%= src %>/<%= test_runner_name %>.mxml"
|
25
|
+
t.source_path << "test"
|
26
|
+
t.debug = true
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Compile and run the test swf"
|
30
|
+
flashplayer :test => "<%= bin %>/<%= test_swf_name %>"
|
31
|
+
|
32
|
+
task :default => :debug
|
33
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<mx:WindowedApplication
|
3
|
+
xmlns:mx="http://www.adobe.com/2006/mxml"
|
4
|
+
creationComplete="creationCompleteHandler()"
|
5
|
+
x="0" y="0">
|
6
|
+
|
7
|
+
<mx:Script>
|
8
|
+
<![CDATA[
|
9
|
+
import AllTests;
|
10
|
+
|
11
|
+
import org.flexunit.internals.TraceListener;
|
12
|
+
//import org.flexunit.listeners.AirCIListener;
|
13
|
+
import org.flexunit.runner.FlexUnitCore;
|
14
|
+
|
15
|
+
private var _core:FlexUnitCore;
|
16
|
+
|
17
|
+
protected function creationCompleteHandler():void
|
18
|
+
{
|
19
|
+
_core = new FlexUnitCore();
|
20
|
+
|
21
|
+
_core.addListener(new TraceListener());
|
22
|
+
//_core.addListener(new AirCIListener());
|
23
|
+
_core.run(AllTests);
|
24
|
+
}
|
25
|
+
]]>
|
26
|
+
</mx:Script>
|
27
|
+
|
28
|
+
</mx:WindowedApplication>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
package
|
2
|
+
{
|
3
|
+
|
4
|
+
/**
|
5
|
+
* This file has been automatically created using
|
6
|
+
* the project sprouts FlexUnit gem.
|
7
|
+
*
|
8
|
+
* If you modify it and run this script, your
|
9
|
+
* modifications will be lost!
|
10
|
+
*/
|
11
|
+
<% test_case_classes.each do |test_case| %>import <%= test_case %>;
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
[Suite]
|
15
|
+
[RunWith("org.flexunit.runners.Suite")]
|
16
|
+
public class AllTests
|
17
|
+
{
|
18
|
+
<% test_case_classes.each do |test_case| %>public var <%= test_case.gsub('.', '_') %>:<%= test_case %>;
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
}
|
22
|
+
|
23
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
package <%= package_name %>
|
2
|
+
{
|
3
|
+
|
4
|
+
import org.flexunit.Assert;
|
5
|
+
|
6
|
+
public class <%= test_class_name %>
|
7
|
+
{
|
8
|
+
private var <%= instance_name %>:<%= class_name %>;
|
9
|
+
|
10
|
+
[Before]
|
11
|
+
public function setUp():void
|
12
|
+
{
|
13
|
+
<%= instance_name %> = new <%= class_name %>();
|
14
|
+
}
|
15
|
+
|
16
|
+
[After]
|
17
|
+
public function tearDown():void
|
18
|
+
{
|
19
|
+
<%= instance_name %> = null;
|
20
|
+
}
|
21
|
+
|
22
|
+
[Test]
|
23
|
+
public function shouldBeInstantiated():void
|
24
|
+
{
|
25
|
+
Assert.assertTrue("<%= instance_name %> is <%= class_name %>", <%= instance_name %> is <%= class_name %>);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
}
|
30
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
require 'bundler/setup'
|
4
|
+
|
5
|
+
require 'rake/clean'
|
6
|
+
require 'flashsdk'
|
7
|
+
require 'flexunit'
|
8
|
+
|
9
|
+
##
|
10
|
+
# Set USE_FCSH to true in order to use FCSH for all compile tasks.
|
11
|
+
#
|
12
|
+
# You can also set this value by calling the :fcsh task
|
13
|
+
# manually like:
|
14
|
+
#
|
15
|
+
# rake fcsh run
|
16
|
+
#
|
17
|
+
# These values can also be sent from the command line like:
|
18
|
+
#
|
19
|
+
# rake run FCSH_PKG_NAME=flex3
|
20
|
+
#
|
21
|
+
# ENV['USE_FCSH'] = true
|
22
|
+
# ENV['FCSH_PKG_NAME'] = 'flex4'
|
23
|
+
# ENV['FCSH_PKG_VERSION'] = '1.0.14.pre'
|
24
|
+
# ENV['FCSH_PORT'] = 12321
|
25
|
+
|
26
|
+
##############################
|
27
|
+
# Debug
|
28
|
+
|
29
|
+
# Compile the debug swf
|
30
|
+
mxmlc "<%= bin %>/<%= debug_swf_name %>" do |t|
|
31
|
+
t.input = "<%= src %>/<%= class_name %>.as"
|
32
|
+
t.debug = true
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "Compile and run the debug swf"
|
36
|
+
flashplayer :run => "<%= bin %>/<%= debug_swf_name %>"
|
37
|
+
|
38
|
+
##############################
|
39
|
+
# Test
|
40
|
+
|
41
|
+
library :flexunit
|
42
|
+
|
43
|
+
# Compile the test swf
|
44
|
+
mxmlc "<%= bin %>/<%= test_swf_name %>" => :flexunit do |t|
|
45
|
+
t.input = "<%= src %>/<%= test_runner_name %>.as"
|
46
|
+
t.source_path << 'test'
|
47
|
+
t.debug = true
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "Compile and run the test swf"
|
51
|
+
flashplayer :test => "<%= bin %>/<%= test_swf_name %>"
|
52
|
+
|
53
|
+
##############################
|
54
|
+
# SWC
|
55
|
+
|
56
|
+
compc "<%= bin %>/<%= class_name %>.swc" do |t|
|
57
|
+
t.input_class = "<%= class_name %>"
|
58
|
+
t.source_path << 'src'
|
59
|
+
end
|
60
|
+
|
61
|
+
desc "Compile the SWC file"
|
62
|
+
task :swc => '<%= bin %>/<%= class_name %>.swc'
|
63
|
+
|
64
|
+
##############################
|
65
|
+
# DOC
|
66
|
+
|
67
|
+
desc "Generate documentation at <%= doc %>/"
|
68
|
+
asdoc '<%= doc %>' do |t|
|
69
|
+
t.doc_sources << "<%= src %>"
|
70
|
+
t.exclude_sources << "<%= src %>/<%= test_runner_name %>.as"
|
71
|
+
end
|
72
|
+
|
73
|
+
##############################
|
74
|
+
# DEFAULT
|
75
|
+
task :default => :run
|
76
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module FlexUnit4
|
2
|
+
class TestClassGenerator < FlashSDK::ClassGenerator
|
3
|
+
|
4
|
+
def manifest
|
5
|
+
directory test_class_directory do
|
6
|
+
template "#{test_class_name}.as", 'FlexUnit4TestClass.as'
|
7
|
+
end
|
8
|
+
|
9
|
+
generator :suite_class, {:input => 'AllTests.as'}
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestClassGeneratorTest < Test::Unit::TestCase
|
4
|
+
include Sprout::TestHelper
|
5
|
+
|
6
|
+
context "A new test class generator" do
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@temp = File.join(fixtures, 'generators', 'tmp')
|
10
|
+
FileUtils.mkdir_p @temp
|
11
|
+
@generator = FlexUnit4::TestClassGenerator.new
|
12
|
+
@generator.path = @temp
|
13
|
+
@generator.logger = StringIO.new
|
14
|
+
end
|
15
|
+
|
16
|
+
teardown do
|
17
|
+
remove_file @temp
|
18
|
+
end
|
19
|
+
|
20
|
+
should "generate test class and add it to the test suite" do
|
21
|
+
@generator.input = "org.BrainUtils"
|
22
|
+
@generator.execute
|
23
|
+
|
24
|
+
suite_dir = File.join(@temp, "test")
|
25
|
+
assert_directory suite_dir
|
26
|
+
|
27
|
+
suite_file = File.join(suite_dir, "AllTests.as")
|
28
|
+
|
29
|
+
assert_file suite_file do |content|
|
30
|
+
assert_matches /import org.BrainUtilsTest/, content
|
31
|
+
assert_matches /public var org_BrainUtilsTest:org\.BrainUtilsTest/, content
|
32
|
+
end
|
33
|
+
|
34
|
+
class_dir = File.join(@temp, "test", "org")
|
35
|
+
assert_directory class_dir
|
36
|
+
|
37
|
+
test_file = File.join(class_dir, "BrainUtilsTest.as")
|
38
|
+
|
39
|
+
assert_file test_file do |content|
|
40
|
+
assert_match /org/, content
|
41
|
+
assert_match /BrainUtilsTest/, content
|
42
|
+
assert_match /class BrainUtilsTest/, content
|
43
|
+
assert_match /class BrainUtilsTest/, content
|
44
|
+
assert_match /private var .*:BrainUtils;/, content
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler"
|
3
|
+
|
4
|
+
Bundler.setup :default, :development
|
5
|
+
|
6
|
+
require 'sprout'
|
7
|
+
# These require statments *must* be in this order:
|
8
|
+
# http://bit.ly/bCC0Ew
|
9
|
+
# Somewhat surprised they're not being required by Bundler...
|
10
|
+
require 'shoulda'
|
11
|
+
require 'mocha'
|
12
|
+
|
13
|
+
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
|
14
|
+
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
15
|
+
|
16
|
+
require 'flexunit'
|
17
|
+
require 'flashsdk'
|
18
|
+
require 'sprout/test_helper'
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flexunit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3.pre
|
5
|
+
prerelease: 6
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Simon Gregory
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-05-10 00:00:00.000000000 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
description: FlexUnit 4 is meta-data driven allowing you to have extreme freedom and
|
16
|
+
ease when creating tests.
|
17
|
+
email:
|
18
|
+
- projectsprouts@googlegroups.com
|
19
|
+
executables:
|
20
|
+
- fu-flex
|
21
|
+
- fu-as3
|
22
|
+
- fu-runner
|
23
|
+
extensions: []
|
24
|
+
extra_rdoc_files: []
|
25
|
+
files:
|
26
|
+
- bin/fu-as3
|
27
|
+
- bin/fu-flex
|
28
|
+
- bin/fu-runner
|
29
|
+
- flexunit.gemspec
|
30
|
+
- Gemfile
|
31
|
+
- Gemfile.lock
|
32
|
+
- lib/flexunit.rb
|
33
|
+
- lib/flexunit4/generators/flex_project_generator.rb
|
34
|
+
- lib/flexunit4/generators/project_generator.rb
|
35
|
+
- lib/flexunit4/generators/runner_generator.rb
|
36
|
+
- lib/flexunit4/generators/suite_class_generator.rb
|
37
|
+
- lib/flexunit4/generators/templates/ActionScript3Class.as
|
38
|
+
- lib/flexunit4/generators/templates/ActionScript3MainClass.as
|
39
|
+
- lib/flexunit4/generators/templates/ActionScript3RunnerClass.as
|
40
|
+
- lib/flexunit4/generators/templates/Flex4Application.mxml
|
41
|
+
- lib/flexunit4/generators/templates/Flex4Main.css
|
42
|
+
- lib/flexunit4/generators/templates/Flex4Rakefile.rb
|
43
|
+
- lib/flexunit4/generators/templates/Flex4RunnerClass.mxml
|
44
|
+
- lib/flexunit4/generators/templates/FlexUnit4SuiteClass.as
|
45
|
+
- lib/flexunit4/generators/templates/FlexUnit4TestClass.as
|
46
|
+
- lib/flexunit4/generators/templates/Gemfile
|
47
|
+
- lib/flexunit4/generators/templates/Rakefile
|
48
|
+
- lib/flexunit4/generators/test_class_generator.rb
|
49
|
+
- POSTINSTALL.rdoc
|
50
|
+
- Rakefile
|
51
|
+
- README.md
|
52
|
+
- test/unit/test_class_generator_test.rb
|
53
|
+
- test/unit/test_helper.rb
|
54
|
+
- test/unit/test_project_generator_test.rb
|
55
|
+
has_rdoc: true
|
56
|
+
homepage: http://projectsprouts.org
|
57
|
+
licenses: []
|
58
|
+
post_install_message: ! "++++++++++++++++++++++++++++++++\nYou have successfully installed
|
59
|
+
Project Sprouts support for FlexUnit!\n\nExample usage:\n\n # Generate a ActionScript
|
60
|
+
3 project named 'SomeProject'\n fu-as3 SomeProject\n\n # Generate a Flex project
|
61
|
+
named 'SomeFlexProject'\n fu-flex SomeFlexProject\n\n # Generate a new class,
|
62
|
+
test case and test suite:\n sprout-class utils.MathUtil\n\n # Compile and run
|
63
|
+
the test harness:\n rake test\n\n # List available rake tasks:\n rake -T\n\n
|
64
|
+
\ # List available generators:\n sprout-\n # or:\n fu-\n (followed by the TAB
|
65
|
+
key)\n"
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 1.3.7
|
81
|
+
requirements: []
|
82
|
+
rubyforge_project: flexunit
|
83
|
+
rubygems_version: 1.6.2
|
84
|
+
signing_key:
|
85
|
+
specification_version: 3
|
86
|
+
summary: FlexUnit is a unit testing framework for Flex and ActionScript 3.0 applications
|
87
|
+
and libraries.
|
88
|
+
test_files: []
|