所有,
我遇到了标准fields_for设置的问题.在我的"_form"部分我有:
<div class="comment_list">
<%= f.fields_for :comments do |cf| %>
<%= render :partial => 'comments/comment_fields', :locals => {:f => cf, :tester => true} %>
<% end %>
<%= link_to_add_fields "Add a comment", f, :comments %>
</div>
Run Code Online (Sandbox Code Playgroud)
在"_comment_fields"部分中,我有通常的字段,然后是我的测试变量:
<%= tester.to_s %>
Run Code Online (Sandbox Code Playgroud)
当我删除测试器变量时,一切都运行良好.一旦我添加测试变量,我就会收到此错误:
ActionView :: Template :: Error(#Class的未定义局部变量或方法`tester':0xa1f3664>:0xa1f1bd4>)
有没有其他人在使用具有多个本地的fields_for时遇到此问题?
为了详细说明,我的"_comment_fields"部分看起来像这样:
<div class="comment dynamic_field">
<span class="comment_content"><%= f.text_field :content, :class => "comment_content" %></span>
<%= tester.to_s %>
<%= link_to_remove_fields "remove", f %>
</div>
Run Code Online (Sandbox Code Playgroud)
它仅从"_form"部分调用.
我很难让简单的文件上传测试工作.我在使用Cucumber和Capybara的ruby 1.9.2上使用Rails 3.0.0.
视图:
<%= form_tag "/upload/create", :multipart => true do %>
<label for="file">File to Upload:</label>
<%= file_field_tag "file" %>
<%= submit_tag "Upload" %>
<% end %>
Run Code Online (Sandbox Code Playgroud)
黄瓜步骤:
When /^I upload the basic file$/ do
visit path_to("upload")
path = File.join(::Rails.root, "somefile")
attach_file("file", path)
click_button("Upload")
end
Run Code Online (Sandbox Code Playgroud)
在我的控制器中,除了:
def create
file = params[:file]
end
Run Code Online (Sandbox Code Playgroud)
Gemfile片段:
group :development, :test do
# testing with specs
gem "ZenTest", ">= 4.3.3"
gem "autotest"
gem "rspec-rails", ">= 2.0.0.beta.19", :git => "git://github.com/rspec/rspec-rails.git"
gem "rspec", :git => "git://github.com/rspec/rspec.git"
gem …Run Code Online (Sandbox Code Playgroud) 我有一段代码,看起来像这样:
Repo.transaction(fn ->
Repo.query!("set transaction isolation level serializable;")
# do some queries
end)
Run Code Online (Sandbox Code Playgroud)
在我的测试套件中,我不断遇到错误:
(Postgrex.Error) ERROR 25001 (active_sql_transaction): SET TRANSACTION ISOLATION LEVEL must be called before any query
Run Code Online (Sandbox Code Playgroud)
我想知道我是否在做一些根本性错误的事情,或者是否缺少有关测试环境的某些内容。
谢谢!
该Structs.cs文件看起来像这样:
using System;
using ObjCRuntime;
namespace EDQueue
{
// => Enums attributed with[NativeAttribute] must have an underlying type of `long` or `ulong`
[Native]
public enum EDQueueResult : long
{
Success = 0,
Fail,
Critical
}
}
Run Code Online (Sandbox Code Playgroud)
该ApiDefinition.cs文件类似于:
using System;
using Foundation;
using ObjCRuntime;
namespace EDQueue
{
// typedef void (^EDQueueCompletionBlock)(EDQueueResult);
delegate void EDQueueCompletionBlock(EDQueueResult result);
// ETC....
// @protocol EDQueueDelegate <NSObject>
[Protocol, Model]
[BaseType(typeof(NSObject))]
interface EDQueueDelegate
{
// @optional -(EDQueueResult)queue:(EDQueue *)queue processJob:(NSDictionary *)job; …Run Code Online (Sandbox Code Playgroud) binding ×1
c# ×1
capybara ×1
cucumber ×1
ecto ×1
elixir ×1
file-upload ×1
ios ×1
locals ×1
partial ×1
postgresql ×1
postgrex ×1
xamarin ×1
xamarin.ios ×1