小编Gus*_*dez的帖子

rspec失败了

从没有rspecs开始失败的地方出现以下错误:

ruby 1.8.7,rails 3.06.

~/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby -S bundle exec rspec spec/controllers/gift_cards_controller_spec.rb:30
No DRb server is running. Running in local process instead ...
Run filtered including {:line_number=>30}
F

Failures:

  1) GiftCardsController POST to :create for a logged-in User with valid attributes 
     Failure/Error: it { should respond_with(:redirect) }
     NoMethodError:
       undefined method `respond_with' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1::Nested_1:0x11af4324>
     # ./spec/controllers/gift_cards_controller_spec.rb:30

Finished in 0.93776 seconds
1 example, 1 failure
Run Code Online (Sandbox Code Playgroud)

controller rspec ruby-on-rails

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

如何使用条件限制域结果

我是 grails 新手,我有一个关于限制查询结果的问题:域用户:

class User {    
    String login
    String password
    String fname
    String lname
    String role = "user"    

    static constraints = {
        login    (size:5..15, blank:false, unique:true, matches:"[a-zA-Z0-9]+")
        password (size:5..15, blank:false)
        fname    (blank:false)
        lname    (blank:false)
        role     (inList:["user", "admin"])
    }

    String toString(){
        fname & " " & lname
    }

    static mapping = {
        cache true

        columns {
            fname     type:'text'
            lname     type: 'text'
            password  type:'text'
            login     type:'text'
        }   
    }
}
Run Code Online (Sandbox Code Playgroud)

我的 GSP 页面片段显示了结果:

<g:each in="${userInstanceList}" status="i" var="userInstance">
  <tr class="${(i % 2) == 0 …
Run Code Online (Sandbox Code Playgroud)

grails groovy

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

标签 统计

controller ×1

grails ×1

groovy ×1

rspec ×1

ruby-on-rails ×1