小编mis*_*hod的帖子

SpyOn使用茉莉花的骨干视图方法

我有一个骨干视图,我想创建一个测试来确认某个元素上的click事件将调用绑定到该元素的函数.我的观点是:

PromptView = Backbone.View.extend({
        id:"promptPage",
        attributes:{
            "data-role":"page",
            "data-theme":"a"
        },
        events:{
            "click #btnYes":    "answerYes",
            "tap #btnYes":      "answerYes"
        },
        render: function(){
            $(this.el).html(_.template($('#promptPage-template').html(), this.model.toJSON()));

            return this;
        },
        answerYes: function(){
            alert('yes');
        }
    });
Run Code Online (Sandbox Code Playgroud)

我的规格是:

beforeEach(function() {
            model = new PromptModel;
            view = new PromptView({model:model});
            loadFixtures('promptPage.tmpl');
        });

 it("should be able to answer a question with yes", function() {
                var button = $("#btnYes", view.render().el);
                expect(button.length).toBe(1);

                spyOn(view, 'answerYes');

                button.click();
                expect(view.answerYes).toHaveBeenCalled();

            });
Run Code Online (Sandbox Code Playgroud)

但是上面的视图定义在原型proto上创建了answerYes方法,但是间谍在视图中的实际实例上创建了一个函数,所以我最终得到了一个view.answerYes(),这是间谍和视图.__ proto __.answerYes,这是我真正想要窥探的那个.

如何创建一个间谍,以便它覆盖视图定义的answerYes方法?

view spy backbone.js jasmine

18
推荐指数
2
解决办法
6195
查看次数

TeamCity代理错误"无法在代理上执行结帐"

我在MacOS上运行TeamCity 7服务器和代理.我的回购是在github上.我使用ssh,我知道验证配置正确,因为测试成功.

当我使用VCS Checkout模式"在服务器上自动"时,构建工作正常,但是当我使用VCS Checkout模式"Automatically on agent"时,我收到此错误.

[13:40:35][Updating sources] Failed to perform checkout on agent: '/usr/bin/git fetch --progress origin +refs/heads/master:refs/remotes/origin/master' command failed.
stderr: java.io.IOException: Authentication failed
    at org.jetbrains.git4idea.ssh.SSHMain.authenticate(SSHMain.java:275)
    at org.jetbrains.git4idea.ssh.SSHMain.start(SSHMain.java:159)
    at org.jetbrains.git4idea.ssh.SSHMain.main(SSHMain.java:139)
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

teamcity github agent teamcity-7.0

13
推荐指数
1
解决办法
1万
查看次数

如何为TeamCIty中的挂起更改组成git日志

我有一个TeamCity代理配置为构建我的XCode项目,我使用github.我想在我的发行说明中自动包含TeamCity中所有待处理提交的描述.

如何从github获取它们并将它们存储在teamcity中?一旦我将它们放入teamcity变量中,我就可以轻松地将它们添加到我的构建脚本中.

git teamcity commit github

12
推荐指数
2
解决办法
4110
查看次数

-[UICIColor colorSpaceName]:无法识别的选择器已发送到实例

我在iOS 5应用中创建了几个主题支持类。我的主题存储在plist中,并将它们加载到Theme对象中,该主题在我的应用中用于初始化各种控件。我将颜色存储为主题中的字符串,然后使用此代码将它们转换为UIColor:

UIColor* color = [UIColor colorWithCIColor:[CIColor colorWithString:@"0.5 0.5 0.5 1.0"]];
Run Code Online (Sandbox Code Playgroud)

这对于大多数控件都可以正常工作,但是当我尝试像这样设置导航栏的色调颜色时:

//navigation bar
[self.navigationController.navigationBar setTintColor:color];
Run Code Online (Sandbox Code Playgroud)

我得到这个例外:

-[UICIColor colorSpaceName]: unrecognized selector sent to instance
Run Code Online (Sandbox Code Playgroud)

当我不使用CIColor初始化颜色时,例如:

UIColor* color = [UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:1.0];
[self.navigationController.navigationBar setTintColor:color];
Run Code Online (Sandbox Code Playgroud)

一切都很好。

任何线索是什么原因造成的?我找不到有关UICIColor的太多信息,但是我正在猜测,因为UIColor只是CGColor或CIColor之上的包装,因此在实现上存在差异。

user-interface objective-c ios

5
推荐指数
1
解决办法
1863
查看次数

例外类型:EXC_CRASH(SIGTRAP)

在非常罕见的情况下,但非常坚持我们的一些用户将在我们的应用程序中崩溃.当它们从菜单中选择某些内容时,它会崩溃,但是很快就会崩溃.那些看到它总是得到它,其他人都很好.有人可以看到一些可以帮助我追踪它的东西吗?

Exception Type:  EXC_CRASH (SIGTRAP)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x31495848 __kill + 8
1   MYApp                           0x0007a8b6 TFHandleExceptions + 986
2   CoreFoundation                  0x372df950 __handleUncaughtException + 68
3   libobjc.A.dylib                 0x34fe433e _objc_terminate + 122
4   libc++abi.dylib                 0x36a173be safe_handler_caller(void (*)()) + 70
5   libc++abi.dylib                 0x36a1744a std::terminate() + 14
6   libc++abi.dylib                 0x36a1881e __cxa_rethrow + 82
7   libobjc.A.dylib                 0x34fe42a2 objc_exception_rethrow + 6
8   CoreFoundation                  0x37235506 CFRunLoopRunSpecific + 398
9   CoreFoundation                  0x37235366 CFRunLoopRunInMode …
Run Code Online (Sandbox Code Playgroud)

crash ios

2
推荐指数
1
解决办法
4493
查看次数