小编kar*_*eem的帖子

使用Authlogic进行集成测试?

对于我的生活,我不明白为什么Authlogic没有在这个集成测试中登录我.我没有遇到任何问题,Authlogic使用此代码在功能测试中登录我.根据authlogic rdocs(http://tinyurl.com/mb2fp2),模拟登录状态在功能和集成测试中是相同的,所以我很困惑.任何帮助深表感谢!

class TipsController < ApplicationController
  before_filter :require_user,  :only => [:destroy, :undelete]
  def destroy
    @tip = Tip.find(params[:id])

    if can_delete?(@tip)

      @tip.destroy

      set_flash("good", "Tip deleted. <a href=\"#{undelete_tip_url(@tip.id)}\">Undo?</a>")
      respond_to do |format|
        format.html { redirect_to city_path(@tip.city)} 
      end
    else
      set_flash("bad", "Seems like you can't delete this tip, sorry.")
      respond_to do |format|
        format.html { render :action => "show", :id => @tip} 
      end
    end
  end
end


class DeleteTipAndRender < ActionController::IntegrationTest
  context "log user in" do
    setup do
      @user = create_user
      @tip = create_tip
    end

    context …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails authlogic

10
推荐指数
1
解决办法
5268
查看次数

如何在多站点应用程序上设置子域的集成测试长度?

在集成测试期间更改子域的最佳方法是什么?

jamis buck建议使用主机!这里:http: //weblog.jamisbuck.org/2006/3/9/integration-testing-in-rails-1-1#12

但是根据rails API,主持人!仅更改以下单个请求的主机.我在功能测试中寻找类似@ request.host的东西,这让我可以在整个测试中使用子域.

subdomain integration-testing ruby-on-rails

6
推荐指数
1
解决办法
1706
查看次数

如何更改链接的直通/删除颜色?

我有一个带有删除线的链接.我想让删除线更轻,因此链接文本更容易阅读,但无法弄清楚如何做到这一点.

这就是我想要它的样子(使用内部跨度而不是链接,因为它以我想要的方式出现):

span.outer {
  color: red;
  text-decoration: line-through;
}
span.inner {
  color: green;
}
Run Code Online (Sandbox Code Playgroud)
<span class="outer">
  <span class="inner">foo bar</span>
</span>
Run Code Online (Sandbox Code Playgroud)

但这似乎不起作用:

span.outer {
  color: red;
  text-decoration: line-through;
}
a.inner {
  color: green;
}
Run Code Online (Sandbox Code Playgroud)
<span class="outer">
  <a href="#" class="inner">foo bar</a>
</span>
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

css strikethrough line-through

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

使用Authlogic保存用户时,Crypted_pa​​ssword为null

当我尝试使用AL创建新用户时,我的生产安装上出现了一个奇怪的错误:

ActiveRecord :: StatementInvalid:Mysql :: Error:列'crypted_pa​​ssword'不能为null:INSERT INTO users

特别奇怪的b/c它在我当地的盒子上按预期工作.

两个盒子上的RUNning Rails 2.3.2和ruby 1.8.7.

user.rb:
class User < ActiveRecord::Base
 before_create :set_username
  acts_as_authentic do |c|
    c.require_password_confirmation = false
    c.login_field = "email"
    c.validates_length_of_password_field_options = {:minimum => 4}  
    c.validate_login_field = false  #don't validate email field with additional validations 
  end
end
Run Code Online (Sandbox Code Playgroud)

这是我的生产控制台的输出:

>> u = User.new
=> #<User id: nil, username: nil, email: nil, crypted_password: nil,
    password_salt: nil, persistence_token: nil, single_access_token: nil,
    perishable_token: nil, login_count: 0, failed_login_count: 0,
    last_request_at: nil, current_login_at: nil, last_login_at: nil,
    current_login_ip: …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails authlogic ruby-on-rails-plugins

3
推荐指数
1
解决办法
3046
查看次数