Rails 3,Cucumber 0.9.4,Capybara 0.4.0
我想用子域测试我的功能.我找到了解决方案:
Given /^I visit subdomain "(.+)"$/ do |sub|
Capybara.default_host = "#{sub}.example.com" #for Rack::Test
Capybara.app_host = "http://#{sub}.example.com:9887" if Capybara.current_driver == :culerity
end
Run Code Online (Sandbox Code Playgroud)
它运行,如果我运行,cucumber features/subdomain.feature但如果我运行它失败cucumber features!这是令人难以置信的,但这是真的.我记录当前的URL,这是subdomain.example.com对cucumber features/subdomain.feature和www.example.com对cucumber features与一个场景
Scenario: subdomain scenario
Given I visit subdomain "subdomain"
Run Code Online (Sandbox Code Playgroud)
在这两种情况下!
我不知道原因......
有没有最好的方法来测试带有水豚的子域名?
subdomain integration-testing cucumber capybara ruby-on-rails-3
我正在为一个页面编写单元测试,该页面使用几个Submit按钮来控制通过我的Django应用程序的逻辑流程.
不幸的是,我无法弄清楚如何获得响应以返回单元测试框架中的提交值.发布的Django单元测试文档表明其形式如下:
post(path, data={}, content_type=MULTIPART_CONTENT, follow=False, **extra)
Run Code Online (Sandbox Code Playgroud)
如果是表单的删除按钮:
<input type="submit" name="delete" value="Delete" />
Run Code Online (Sandbox Code Playgroud)
我已经尝试将Delete值作为数据放置,即:
response = self.client.post(url, {'name':'delete'}, follow=True)
Run Code Online (Sandbox Code Playgroud)
但这似乎不起作用.我需要有名称值才能运行它们触发的代码路径.在视图中,逻辑采用以下形式:
if 'delete' in request.POST:
<do something>
Run Code Online (Sandbox Code Playgroud)
我假设我以某种方式使用**以获得这些值,但我也没有太多运气.
有什么建议?
我想,因为它似乎在改变我的进程的名称ps,并Activity Monitor在运行时.我发现有几个笔记说没有可移植的方法(我不关心).
这是我尝试过的.这些方法都不适合我.
argv[0](似乎是在某些Unix系统上的方式)[[NSProcessInfo processInfo] setProcessName:@"someName"]setprogname(调用getprogname返回我设置的名称,但这是无关紧要的)我还读到了一个被调用的函数setproctitle,stdlib.h如果它可用,应该定义它,但它不存在.
必须有一种方法可以实现这一点,因为QTKitServer-- QuickTime Player X的无面解码器 - 在其进程名称中具有相应的QuickTime Player的PID.
有没有人知道如何做到这一点?我非常喜欢使用Core Foundation或POSIXy方法来实现Objective-C方法.
谢谢,
马尔科
编辑:如果它有任何相关性,我使用的是Mac OS X 10.6.5和Xcode 3.2.5
我需要页面滚动才能看到元素.
我试过的选项:
jQuery scrollTo:问题是页面滚动使元素位于顶部(或者至少它试图这样做,就像它的工作原理一样:<a name="xyz">/ <a href="#xyz">).我想要的是最小滚动量,以便整个元素可见(并且,如果元素太高,就像那里的锚一样工作).
scrollIntoView:太糟糕了,我想让它顺利滚动(比如$.scrollTo($('#id1'), 'fast');).此外,它似乎也没有做我想要的.
我无法通过Google App Engine从我的应用发送电子邮件.我遇到了几个新的障碍,我将非常感谢你的帮助.
我从教程中获取此功能,对于"发件人"字段,我将我用于创建应用程序的gmail帐户放入:
mail.send_mail(sender="owners_email_acco...@gmail.com",
to="xxxx...@gmail.com",
subject="test email from app",
body="hello")
Run Code Online (Sandbox Code Playgroud)
当我尝试这个时,我得到错误:
InvalidSenderError: Unauthorized sender
Run Code Online (Sandbox Code Playgroud)
但电子邮件
sender="owners_email_acco...@gmail.com",
Run Code Online (Sandbox Code Playgroud)
是我用来登录应用程序的电子邮件; 这是我用来创建应用程序的电子邮件.
教程说:
The email address of the sender, the From address. The sender address must be one of the following types: The address of a registered administrator for the application. You can add administrators to an application using the Administration Console.
所以我用来创建应用程序的电子邮件应该作为发件人.我究竟做错了什么?谢谢.
(我在GAE小组中问同样的问题,但没有回复)
这对我来说是一个非常复杂的MySQL查询.
我所拥有的是一张美国电话号码格式的电话号码表8153216458.
例:
TABLE: numbers(number)
4512163215
4512158211
4512110579
8812163215
9405462136
3021548641
Run Code Online (Sandbox Code Playgroud)
我想要的是列出可用的区号(因为我正在销售数字)而不重复它们,一些基于前3位数的查询并最终正确排序.
Output:
302
451
881
940
Run Code Online (Sandbox Code Playgroud)
有解决方案吗 我不介意它是否还在使用php操作.
谢谢
我想创建一个具有以下结构的maven项目:
A
|--pom.xml
|--B
|--pom.xml
|--C
|--pom.xml
Run Code Online (Sandbox Code Playgroud)
其中A,B和C是文件夹,B的pom.xml和C的pom.xml是A的pom.xml的子代.我想在B的pom.xml中有以下部分:
<properties>
<some.property>B</some.property>
</properties>
Run Code Online (Sandbox Code Playgroud)
而在C:
<properties>
<some.property>C</some.property>
</properties>
Run Code Online (Sandbox Code Playgroud)
我希望在某个东西中根据某些属性的值来定义其他几个属性的值.因此,例如,在伪代码中,A会执行以下操作:
if ( some.property == 'B') then
some.other.property = 'some-value-based-on-b'
else if ( some.property == 'C') then
some.other.property = 'some-value-based-on-c'
...
Run Code Online (Sandbox Code Playgroud)
我想运行MVN全新安装指的是的pom.xml(其中包含一个模块部分指向B和C),所以,据我了解,我不能在maven2的项目中使用的配置文件为这个(因为在相同的运行reactor继承了相同的活动配置文件.我可以使用maven3,但是如果它改变了什么就找不到).
有谁知道如何做到这一点?
谢谢,
我有两个类,比如Group和Person,它有一个映射在JoinTable中的ManyToMany-Relation.
如果我删除与组有关系的Person,我想从连接表中删除该条目(不删除组本身!).
如何定义级联注释?我没有找到真正有用的文档,但有几个未解决的董事会讨论......
public class Group {
@ManyToMany(
cascade = { javax.persistence.CascadeType.? },
fetch = FetchType.EAGER)
@Cascade({CascadeType.?})
@JoinTable(name = "PERSON_GROUP",
joinColumns = { @JoinColumn(name = "GROUP_ID") },
inverseJoinColumns = { @JoinColumn(name = "PERSON_ID") })
private List<Person> persons;
}
public class Person {
@ManyToMany(
cascade = { javax.persistence.CascadeType.? },
fetch = FetchType.EAGER,
mappedBy = "persons",
targetEntity = Group.class)
@Cascade({CascadeType.?})
private List<Group> group;
}
Run Code Online (Sandbox Code Playgroud) 我尝试通过推送它的键盘快捷键在某个插件中执行命令F2.但是执行了一些其他命令.但是那个命令会出错.因此,不清楚干扰命令的键映射在何处定义.我想更改该快捷方式的映射.为此,我需要找出干扰命令是什么.
有没有办法找出某个键盘快捷键触发了哪个命令?
我不能让下面的PHP + jQuery的工作 - 所有我想要的脚本做的是通过Ajax传递价值,并获得PHP的抓住它,检查它匹配,并且加1分.
这是我写的代码:
<?php
$score = "1";
$userAnswer = $_POST['name'];
if ($_POST['name'] == "145"){
$score++;
}else{
//Do nothing
}
echo $score;
?>
<script type="text/javascript">
$(document).ready(function() {
$("#raaagh").click(function(){
var value = "145";
alert(value);
$.ajax({
url: 'processing.php', //This is the current doc
type: "POST",
data: ({name: value}),
success: function(){
location.reload();
}
});
});
});
</script>
<p id="raaagh">Ajax Away</p>
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助,我在两个实例中都将GET更改为POST,并且没有任何乐趣 - 还有其他错误.