我目前对连续调用的模拟设置了一些期望:
规格:
@my_mock = mock("a_mock")
@options1 = {:some => "option"}
@options2 = {:some_other => "option"}
@first_param = mock("first_param")
@my_mock.should_receive(:a_message).with(@first_param, @options1)
@my_mock.should_receive(:a_message).with(@first_param, @options2)
Run Code Online (Sandbox Code Playgroud)
但是,我得到以下内容:
Mock "a_mock" received :a_message with unexpected arguments
expected: (#<Spec::Mocks::Mock:0x81b8ca3c @name="first_param"{:some => "option"})
got: (#<Spec::Mocks::Mock:0x81b8ca3c @name="first_param">, {:some_other => "option"})
Run Code Online (Sandbox Code Playgroud)
当我调试它时,第一个期望被调用.在我可以预期具有相同消息但参数不同的连续呼叫之前,我是否必须指定其他任何内容?
自从我上次在Rails中使用背景以来已经有一段时间了.我之前使用过backgroundrb和bj.还有什么能够更好地管理后台任务吗?
我正在尝试编译用于在iPhone上使用的zeroMQ 的Objective-C绑定(https://github.com/jeremy-w/objc-zmq).
我已经添加了"objc-zmq"项目作为我想要包含它的项目的依赖项.但是,所有符号都可以找到,因为它没有链接到libzmq.a二进制文件.
如何编译libzmq.a以用于iPhone.此外,一旦我有了,我如何将我的项目链接到它?
我尝试了这篇文章中的一些建议:为iPhone编译C lib
然而,这些对我来说毫无结果.任何帮助将不胜感激.
我正在将我的脚趾浸入Android开发中.我有一个项目将与RESTful资源接口,我试图弄清楚如何通过HTTP上的params进行基本GET.从我读过的所有内容来看,共识似乎都支持HTTPClient优于HttpURLConnection.
我编写了一个包装类,其中包含一个方法,该方法负责实例化密钥对象以使用HTTPClient发出请求:
public String get() {
String responseString = null;
HttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet();
try {
get.setURI(new URI(this.baseURL()));
} catch (URISyntaxException e1) {
e1.printStackTrace();
}
HttpResponse response;
try {
response = client.execute(get);
responseString = readResponse(response.getEntity());
if(response != null) {
System.out.println(responseString);
}
} catch(ClientProtocolException e) {
e.printStackTrace();
} catch(IOException e) {
e.printStackTrace();
}
return responseString;
Run Code Online (Sandbox Code Playgroud)
}
该行HttpClient client = new DefaultHttpClient();抛出以下异常:
java.lang.RuntimeException: Stub!
at org.apache.http.impl.client.AbstractHttpClient.<init>(AbstractHttpClient.java:5)
at org.apache.http.impl.client.DefaultHttpClient.<init>(DefaultHttpClient.java:7)
at org.rcindustries.appmap.RestClient.get(RestClient.java:54)
at org.rcindustries.appmap.test.functional.RestClientTest.shouldReturnSomeJSon(RestClientTest.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native …Run Code Online (Sandbox Code Playgroud) 我有一个capistrano任务,它整合了Rails项目的多个阶段的部署.
例如:
task :consolidated_task do
build #creates a new release branch from master,
#sets a variable with the relese branch name
staging
deploy.migrations
production
deploy.migrations
end
Run Code Online (Sandbox Code Playgroud)
这是从另一个上限任务调用多阶段任务的正确方法吗?
构建任务创建一个新的git分支并发布它.新分支的名称将保存为capistrano变量.然后,登台和生产阶段任务使用此变量来指定要部署的分支.
当此任务运行时,它会失败:
fatal: working tree '/Users/<my working directory>' already exists.
/usr/local/lib/ruby/gems/1.8/gems/capistrano-2.5.19/lib/capistrano/recipes/deploy/strategy/copy.rb:99:in `initialize': No such file or directory - /var/folders/3d/3dKYNUwQGOSLZFXsMF-uv++++TM/-Tmp-/20100802182750/REVISION (Errno::ENOENT)
Run Code Online (Sandbox Code Playgroud)
我正在从我的本地机器推送源代码作为git存储库,并且部署机器无法相互通信.
ruby ×2
android ×1
background ×1
capistrano ×1
deployment ×1
httpclient ×1
ios ×1
java ×1
objective-c ×1
rspec ×1
unit-testing ×1
zeromq ×1