rpcoder 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -11,6 +11,5 @@ group :development do
11
11
  gem "jeweler", "~> 1.5.2"
12
12
  gem "rcov", ">= 0"
13
13
  gem "rake", ">= 0"
14
+ gem "sinatra", ">= 0"
14
15
  end
15
-
16
- gem "sinatra"
data/README.rdoc CHANGED
@@ -1,21 +1,41 @@
1
1
  = rpcoder
2
2
 
3
- mock/mock_rpcoder.rb を見ると使い方がなんとなくわかると思います。
4
-
5
- == Mock API の作成
6
-
7
- $ ruby mock/mock_rpcoder.rb
8
-
9
- == Mock swf のビルド
10
-
11
- $ cd mock
12
- $ ant
13
-
14
- == Mock Server の起動
15
-
16
- $ ruby mock/mock_server.rb
17
-
18
- == as3 のテストの実行
19
-
20
- $ cd spec
21
- $ ant
3
+ == installation
4
+
5
+ $ gem install rpcoder
6
+
7
+ == generating AS3 RPC code
8
+
9
+ #!/usr/bin/env ruby
10
+
11
+ require 'rpcoder'
12
+ require 'fileutils'
13
+
14
+ RPCoder.name_space = 'foo.bar.rpc'
15
+ RPCoder.api_class_name = 'RPC'
16
+
17
+ RPCoder.type "Mail" do |t|
18
+ t.add_field :subject, :String
19
+ t.add_field :body, :String
20
+ end
21
+
22
+ RPCoder.function "getMail" do |f|
23
+ f.path = "/mails/:id" # => ("/mails/" + id)
24
+ f.method = "GET"
25
+ f.return_type = "Mail"
26
+ f.add_param :id, "int"
27
+ f.description = 'メールを取得'
28
+ end
29
+
30
+ RPCoder.function "sendMail" do |f|
31
+ f.path = "/mails" # => ("/mails/" + id)
32
+ f.method = "POST"
33
+ f.return_type = "void"
34
+ f.add_param :subject, "String"
35
+ f.add_param :body, "String"
36
+ f.description = 'メールを送信'
37
+ end
38
+
39
+ # output codes
40
+ dir = File.expand_path('src', File.dirname(__FILE__))
41
+ RPCoder.export(dir)
data/Rakefile CHANGED
@@ -16,13 +16,15 @@ Jeweler::Tasks.new do |gem|
16
16
  gem.homepage = "http://github.com/one-up/rpcoder"
17
17
  gem.license = "MIT"
18
18
  gem.summary = %Q{Simple RPC generator for as3}
19
- gem.description = %Q{Simple RPC generator for as3}
19
+ gem.description = %Q{Simple JSON HTTP RPC generator for as3}
20
20
  gem.email = "toshi.hirooka@gmail.com"
21
21
  gem.authors = ["jugyo", "Toshiyuki Hirooka"]
22
22
  # Include your dependencies below. Runtime dependencies are required when using your gem,
23
23
  # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
24
  # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25
25
  # gem.add_development_dependency 'rspec', '> 1.2.3'
26
+
27
+ gem.files.exclude 'mock/'
26
28
  end
27
29
  Jeweler::RubygemsDotOrgTasks.new
28
30
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.0.1
data/rpcoder.gemspec CHANGED
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rpcoder}
8
- s.version = "0.0.0"
8
+ s.version = "0.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["jugyo", "Toshiyuki Hirooka"]
12
12
  s.date = %q{2011-04-25}
13
- s.description = %q{Simple RPC generator for as3}
13
+ s.description = %q{Simple JSON HTTP RPC generator for as3}
14
14
  s.email = %q{toshi.hirooka@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
@@ -28,22 +28,6 @@ Gem::Specification.new do |s|
28
28
  "lib/rpcoder/type.rb",
29
29
  "lib/templates/API.erb",
30
30
  "lib/templates/Type.erb",
31
- "mock/build.xml",
32
- "mock/lib/as3corelib.swc",
33
- "mock/lib/flexUnitTasks-4.0.0.jar",
34
- "mock/lib/flexunit-4.0.0.swc",
35
- "mock/lib/flexunit-cilistener-4.0.0.swc",
36
- "mock/lib/flexunit-flexcoverlistener-4.0.0.swc",
37
- "mock/lib/flexunit-uilistener-4.0.0.swc",
38
- "mock/lib/hamcrest-as3-1.1.1.swc",
39
- "mock/lib/mockolate-0.9.3.swc",
40
- "mock/mock_rpcoder.rb",
41
- "mock/mock_server.rb",
42
- "mock/src/Mock.mxml",
43
- "mock/src_test/FlexUnitRunner.mxml",
44
- "mock/src_test/TestSuite.as",
45
- "mock/src_test/com/oneup/rpcoder/test/APITest.as",
46
- "mock/src_test/com/oneup/rpcoder/test/TypeTest.as",
47
31
  "rpcoder.gemspec",
48
32
  "spec/fixtures/foo/bar/API.as",
49
33
  "spec/fixtures/foo/bar/Mail.as",
@@ -66,27 +50,27 @@ Gem::Specification.new do |s|
66
50
  s.specification_version = 3
67
51
 
68
52
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
69
- s.add_runtime_dependency(%q<sinatra>, [">= 0"])
70
53
  s.add_development_dependency(%q<rspec>, [">= 0"])
71
54
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
72
55
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
73
56
  s.add_development_dependency(%q<rcov>, [">= 0"])
74
57
  s.add_development_dependency(%q<rake>, [">= 0"])
58
+ s.add_development_dependency(%q<sinatra>, [">= 0"])
75
59
  else
76
- s.add_dependency(%q<sinatra>, [">= 0"])
77
60
  s.add_dependency(%q<rspec>, [">= 0"])
78
61
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
79
62
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
80
63
  s.add_dependency(%q<rcov>, [">= 0"])
81
64
  s.add_dependency(%q<rake>, [">= 0"])
65
+ s.add_dependency(%q<sinatra>, [">= 0"])
82
66
  end
83
67
  else
84
- s.add_dependency(%q<sinatra>, [">= 0"])
85
68
  s.add_dependency(%q<rspec>, [">= 0"])
86
69
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
87
70
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
88
71
  s.add_dependency(%q<rcov>, [">= 0"])
89
72
  s.add_dependency(%q<rake>, [">= 0"])
73
+ s.add_dependency(%q<sinatra>, [">= 0"])
90
74
  end
91
75
  end
92
76
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rpcoder
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.0
5
+ version: 0.0.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - jugyo
@@ -14,51 +14,51 @@ cert_chain: []
14
14
  date: 2011-04-25 00:00:00 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
- name: sinatra
17
+ name: rspec
18
18
  requirement: &id001 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
23
  version: "0"
24
- type: :runtime
24
+ type: :development
25
25
  prerelease: false
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency
28
- name: rspec
28
+ name: bundler
29
29
  requirement: &id002 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
- - - ">="
32
+ - - ~>
33
33
  - !ruby/object:Gem::Version
34
- version: "0"
34
+ version: 1.0.0
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: *id002
38
38
  - !ruby/object:Gem::Dependency
39
- name: bundler
39
+ name: jeweler
40
40
  requirement: &id003 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: 1.0.0
45
+ version: 1.5.2
46
46
  type: :development
47
47
  prerelease: false
48
48
  version_requirements: *id003
49
49
  - !ruby/object:Gem::Dependency
50
- name: jeweler
50
+ name: rcov
51
51
  requirement: &id004 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
- - - ~>
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 1.5.2
56
+ version: "0"
57
57
  type: :development
58
58
  prerelease: false
59
59
  version_requirements: *id004
60
60
  - !ruby/object:Gem::Dependency
61
- name: rcov
61
+ name: rake
62
62
  requirement: &id005 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
@@ -69,7 +69,7 @@ dependencies:
69
69
  prerelease: false
70
70
  version_requirements: *id005
71
71
  - !ruby/object:Gem::Dependency
72
- name: rake
72
+ name: sinatra
73
73
  requirement: &id006 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
@@ -79,7 +79,7 @@ dependencies:
79
79
  type: :development
80
80
  prerelease: false
81
81
  version_requirements: *id006
82
- description: Simple RPC generator for as3
82
+ description: Simple JSON HTTP RPC generator for as3
83
83
  email: toshi.hirooka@gmail.com
84
84
  executables: []
85
85
 
@@ -100,22 +100,6 @@ files:
100
100
  - lib/rpcoder/type.rb
101
101
  - lib/templates/API.erb
102
102
  - lib/templates/Type.erb
103
- - mock/build.xml
104
- - mock/lib/as3corelib.swc
105
- - mock/lib/flexUnitTasks-4.0.0.jar
106
- - mock/lib/flexunit-4.0.0.swc
107
- - mock/lib/flexunit-cilistener-4.0.0.swc
108
- - mock/lib/flexunit-flexcoverlistener-4.0.0.swc
109
- - mock/lib/flexunit-uilistener-4.0.0.swc
110
- - mock/lib/hamcrest-as3-1.1.1.swc
111
- - mock/lib/mockolate-0.9.3.swc
112
- - mock/mock_rpcoder.rb
113
- - mock/mock_server.rb
114
- - mock/src/Mock.mxml
115
- - mock/src_test/FlexUnitRunner.mxml
116
- - mock/src_test/TestSuite.as
117
- - mock/src_test/com/oneup/rpcoder/test/APITest.as
118
- - mock/src_test/com/oneup/rpcoder/test/TypeTest.as
119
103
  - rpcoder.gemspec
120
104
  - spec/fixtures/foo/bar/API.as
121
105
  - spec/fixtures/foo/bar/Mail.as
@@ -135,7 +119,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
119
  requirements:
136
120
  - - ">="
137
121
  - !ruby/object:Gem::Version
138
- hash: 1754127494487391921
122
+ hash: -3354813959841474558
139
123
  segments:
140
124
  - 0
141
125
  version: "0"
data/mock/build.xml DELETED
@@ -1,70 +0,0 @@
1
- <project name="Flex Ant Tasks Build Script" default="compile">
2
- <!-- setup a prefix for all environment variables -->
3
- <property environment="env" />
4
-
5
- <!-- Setup paths for build -->
6
- <property name="src.loc" location="${basedir}/src" />
7
- <property name="src.test.loc" location="${basedir}/src_test" />
8
- <property name="lib.loc" location="${basedir}/lib" />
9
- <property name="output.loc" location="${basedir}" />
10
- <property name="bin.loc" location="${output.loc}/bin" />
11
- <property name="report.loc" location="${output.loc}/report" />
12
-
13
- <!-- Setup Flex and FlexUnit ant tasks -->
14
- <!-- You can set this directly so mxmlc will work correctly, or set FLEX_HOME as an environment variable and use as below -->
15
- <property name="FLEX_HOME" location="${env.FLEX_HOME}" />
16
- <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
17
- <taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks-4.0.0.jar" />
18
-
19
- <target name="init">
20
- <!-- Create directories needed for the build process -->
21
- <mkdir dir="${bin.loc}" />
22
- <mkdir dir="${report.loc}" />
23
- </target>
24
-
25
- <target name="mock_rpcoder">
26
- <exec executable="ruby">
27
- <arg line="mock_rpcoder.rb"/>
28
- </exec>
29
- </target>
30
-
31
- <!-- Build and output the Main.swf-->
32
- <target name="compile" depends="init,mock_rpcoder">
33
- <mxmlc file="${src.loc}/Mock.mxml" output="${bin.loc}/Mock.swf">
34
- <source-path path-element="${FLEX_HOME}/frameworks"/>
35
- <library-path dir="${lib.loc}" append="true">
36
- <include name="*.swc" />
37
- </library-path>
38
- <compiler.debug>false</compiler.debug>
39
- </mxmlc>
40
- </target>
41
-
42
- <target name="compile_test_runner" depends="init,mock_rpcoder">
43
- <mxmlc file="${src.test.loc}/FlexUnitRunner.mxml" output="${bin.loc}/FlexUnitRunner.swf">
44
- <source-path path-element="${src.loc}" />
45
- <source-path path-element="${src.test.loc}" />
46
- <library-path dir="${lib.loc}" append="true">
47
- <include name="*.swc" />
48
- </library-path>
49
- <compiler.verbose-stacktraces>true</compiler.verbose-stacktraces>
50
- <compiler.headless-server>true</compiler.headless-server>
51
- </mxmlc>
52
- </target>
53
-
54
- <target name="test" depends="compile_test_runner">
55
- <!-- Execute FlexUnit tests and publish reports -->
56
- <flexunit swf="${bin.loc}/FlexUnitRunner.swf"
57
- toDir="${report.loc}"
58
- haltonfailure="false"
59
- verbose="true"
60
- headless="true"
61
- localTrusted="true" />
62
- <!-- Generate readable JUnit-style reports -->
63
- <junitreport todir="${report.loc}">
64
- <fileset dir="${report.loc}">
65
- <include name="TEST-*.xml" />
66
- </fileset>
67
- <report format="frames" todir="${report.loc}/html" />
68
- </junitreport>
69
- </target>
70
- </project>
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/mock/mock_rpcoder.rb DELETED
@@ -1,46 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- $LOAD_PATH.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
5
- require 'rpcoder'
6
- require 'fileutils'
7
-
8
- #######################################
9
- # API definition
10
- #######################################
11
-
12
- RPCoder.name_space = 'com.oneup.rpcoder.mock'
13
- RPCoder.api_class_name = 'API'
14
-
15
- RPCoder.type "Mail" do |t|
16
- t.add_field :subject, :String
17
- t.add_field :body, :String
18
- end
19
-
20
- RPCoder.function "getMail" do |f|
21
- f.path = "/mails/:id" # => ("/mails/" + id)
22
- f.method = "GET"
23
- f.return_type = "Mail"
24
- f.add_param :id, "int"
25
- f.description = 'メールを取得'
26
- end
27
-
28
- RPCoder.function "sendMail" do |f|
29
- f.path = "/mails" # => ("/mails/" + id)
30
- f.method = "POST"
31
- f.return_type = "void"
32
- f.add_param :subject, "String"
33
- f.add_param :body, "String"
34
- f.description = 'メールを送信'
35
- end
36
-
37
- RPCoder.function "getError" do |f|
38
- f.path = "/error/:statusCode"
39
- f.method = "GET"
40
- f.return_type = "void"
41
- f.add_param :statusCode, :int
42
- f.description = 'Get Error'
43
- end
44
-
45
- dir = File.expand_path('src', File.dirname(__FILE__))
46
- RPCoder.export(dir)
data/mock/mock_server.rb DELETED
@@ -1,34 +0,0 @@
1
- #
2
- # == Usage
3
- #
4
- # $ ruby mock_server.rb
5
- #
6
-
7
- require 'sinatra'
8
- require 'json'
9
-
10
- get '/crossdomain.xml' do
11
- <<XML
12
- <?xml version="1.0"?>
13
- <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
14
- <cross-domain-policy>
15
- <allow-access-from domain="*" />
16
- </cross-domain-policy>
17
- XML
18
- end
19
-
20
- get '/mails/:id' do
21
- puts "url: #{request.url}"
22
- puts "params: #{params.inspect}"
23
- {"id" => params[:id], "subject" => "hi", "body" => "hi, I'm ..."}.to_json
24
- end
25
-
26
- post '/mails' do
27
- puts "url: #{request.url}"
28
- puts "params: #{params.inspect}"
29
- {}.to_json
30
- end
31
-
32
- get '/error/:status_code' do
33
- halt params[:status_code].to_i, "Error[#{params[:status_code]}]"
34
- end
data/mock/src/Mock.mxml DELETED
@@ -1,62 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
3
- xmlns:s="library://ns.adobe.com/flex/spark"
4
- xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
5
-
6
- <fx:Script>
7
- <![CDATA[
8
- import com.oneup.rpcoder.mock.API
9
- import com.oneup.rpcoder.mock.Mail
10
- import mx.rpc.events.FaultEvent;
11
-
12
- protected function button1_clickHandler(event:MouseEvent):void
13
- {
14
- var api:API = new API("http://localhost:4567/");
15
- api.getMail(
16
- 1,
17
- function(result:Mail):void {
18
- outputText.text += "getMail => " + result.toString() + "\n";
19
- },
20
- function(e:FaultEvent):void {
21
- outputText.text += e.statusCode + ": " + e.fault.content + "\n"
22
- }
23
- );
24
- }
25
-
26
- protected function button2_clickHandler(event:MouseEvent):void
27
- {
28
- var api:API = new API("http://localhost:4567/");
29
- api.sendMail('hello', 'hello, I\'m foo',
30
- function():void {
31
- outputText.text += "mail has been sent\n"
32
- },
33
- function(e:FaultEvent):void {
34
- outputText.text += e.statusCode + ": " + e.fault.content + "\n"
35
- }
36
- );
37
- }
38
-
39
- protected function button3_clickHandler(event:MouseEvent):void
40
- {
41
- var api:API = new API("http://localhost:4567/");
42
- api.errorHandler = function(e:FaultEvent, t:Object):void {
43
- outputText.text += e.statusCode + ": " + e.fault.content + "\n"
44
- }
45
- api.getError(
46
- 500,
47
- function():void {},
48
- function(e:FaultEvent):void {}
49
- );
50
- }
51
- ]]>
52
- </fx:Script>
53
-
54
- <fx:Declarations>
55
- <!-- Place non-visual elements (e.g., services, value objects) here -->
56
- </fx:Declarations>
57
-
58
- <s:Button x="10" y="10" label="getMail" click="button1_clickHandler(event)"/>
59
- <s:Button x="100" y="10" label="sendMail" click="button2_clickHandler(event)"/>
60
- <s:Button x="200" y="10" label="getError" click="button3_clickHandler(event)"/>
61
- <s:TextArea x="10" y="39" width="300" height="300" editable="false" id="outputText"/>
62
- </s:Application>
@@ -1,27 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <s:Application
3
- xmlns:fx="http://ns.adobe.com/mxml/2009"
4
- xmlns:s="library://ns.adobe.com/flex/spark"
5
- xmlns:mx="library://ns.adobe.com/flex/mx"
6
- xmlns:adobe="http://www.adobe.com/2009/flexUnitUIRunner"
7
- creationComplete="runMe()">
8
-
9
- <fx:Script>
10
- <![CDATA[
11
- import org.flexunit.listeners.CIListener;
12
- import org.flexunit.listeners.UIListener;
13
- import org.flexunit.runner.FlexUnitCore;
14
-
15
- private var core:FlexUnitCore;
16
-
17
- public function runMe():void {
18
- core = new FlexUnitCore();
19
- core.addListener(new UIListener(uiListener));
20
- core.addListener(new CIListener());
21
- core.run(TestSuite);
22
- }
23
- ]]>
24
- </fx:Script>
25
-
26
- <adobe:TestRunnerBase id="uiListener" width="100%" height="100%" />
27
- </s:Application>
@@ -1,10 +0,0 @@
1
- package {
2
- import com.oneup.rpcoder.test.APITest;
3
- import com.oneup.rpcoder.test.TypeTest;
4
- [Suite]
5
- [RunWith("org.flexunit.runners.Suite")]
6
- public class TestSuite {
7
- public var t1:APITest;
8
- public var t2:TypeTest;
9
- }
10
- }
@@ -1,76 +0,0 @@
1
- package com.oneup.rpcoder.test {
2
- import mx.rpc.AsyncToken;
3
- import mx.rpc.http.HTTPService;
4
- import flash.events.*;
5
- import mockolate.*;
6
- import mx.rpc.events.FaultEvent;
7
- import org.flexunit.asserts.*;
8
- import org.flexunit.async.Async;
9
- import org.hamcrest.core.anything;
10
-
11
- import com.oneup.rpcoder.mock.*;
12
-
13
- public class APITest {
14
- /*
15
- * Preparing
16
- */
17
- [Before(async, timeout=5000)]
18
- public function prepareMockolates() : void {
19
- Async.proceedOnEvent(this, prepare(API, HTTPService, AsyncToken), Event.COMPLETE);
20
- }
21
-
22
- [Test(description="API を new できる")]
23
- public function newAPI() : void {
24
- var api : API = new API('http://example.com/');
25
- assertEquals('http://example.com/', api.baseUrl);
26
- }
27
-
28
- [Test(description="API#getMail を呼び出せる")]
29
- public function callGetMail() : void {
30
- var api : API = nice(API);
31
- mock(api).method("request").args('GET', '/mails/1', anything(), anything(), anything());
32
- stub(api).method("getMail").callsSuper();
33
- api.getMail(
34
- 1,
35
- function(mail : Mail) : void {},
36
- function(e : FaultEvent) : void {}
37
- );
38
- verify(api);
39
- }
40
-
41
- [Test(description="API#sendMail を呼び出せる")]
42
- public function callSendMail() : void {
43
- var api : API = nice(API);
44
- mock(api).method("request").args('POST', '/mails', anything(), anything(), anything());
45
- stub(api).method("sendMail").callsSuper();
46
- api.sendMail(
47
- 'hi',
48
- 'foo bar',
49
- function(mail : Mail) : void {},
50
- function(e : FaultEvent) : void {}
51
- );
52
- verify(api);
53
- }
54
-
55
- [Test(description="API#request を呼び出せる")]
56
- public function callRequest() : void {
57
- var api : API = nice(API);
58
- var service : HTTPService = strict(HTTPService);
59
- var token : AsyncToken = strict(AsyncToken);
60
- var params : Object = {foo:'foo', bar:'bar'};
61
-
62
- stub(api).method("createHttpService").anyArgs().returns(service);
63
- mock(service).setter("method").arg("GET");
64
- mock(service).setter("url").arg('/foo');
65
- mock(service).setter("request").arg(params);
66
- mock(service).setter("resultFormat").arg("text");
67
- mock(service).method("send").returns(token);
68
- mock(token).method("addResponder").anyArgs();
69
-
70
- stub(api).method("request").callsSuper();
71
- api.request('GET', '/foo', params, function():void{}, function():void{});
72
-
73
- verify(service);
74
- }
75
- }
76
- }
@@ -1,25 +0,0 @@
1
- package com.oneup.rpcoder.test {
2
- import org.flexunit.asserts.assertEquals;
3
- import com.oneup.rpcoder.mock.*;
4
-
5
- public class TypeTest
6
- {
7
- [Test(description="オブジェクトを作成できる")]
8
- public function createObject():void
9
- {
10
- var data:Object = {subject:'hi', body: 'foo bar'};
11
- var mail:Mail = new Mail(data);
12
- assertEquals(data['subject'], mail.subject);
13
- assertEquals(data['body'], mail.body);
14
- }
15
-
16
- [Test(description="少ないデータをもとにオブジェクトを作成できる")]
17
- public function createObjectWithFewData():void
18
- {
19
- var data:Object = {subject:'hi'};
20
- var mail:Mail = new Mail(data);
21
- assertEquals(data['subject'], mail.subject);
22
- assertEquals(null, mail.body);
23
- }
24
- }
25
- }