我正在编写测试类来执行我的方法类(在方法类中有一个将要执行的sql语句)
但{n}的let str (s:string) = pstring s
let stringLiteral =
manySatisfy (fun c -> c <> ':' && c <> '\r' && c <> '\n')
let ws = many (pchar ' ')
let keyValueSimple = stringLiteral .>>. (ws >>. str ":" >>. ws >>. stringLiteral) .>>. pchar '\n' |>> (fun (a,b) -> a)
let lineValue = ws >>. stringLiteral .>>. (pchar '\n' .>>. ( pchar '\t')) |>> ( fun (a,b) -> a )
let lastValue = ws >>. stringLiteral .>>. (pchar '\n' .>> notFollowedBy ( pchar '\t') ) |>> ( fun (a,b) -> a )
let keyValueComplex = stringLiteral .>>. (ws >>. pchar ':') .>>. (many lineValue) .>>. lastValue |>> ( fun (((f),d),b) -> (f,f) )
let headers = many1 (keyValueComplex)
let parse (fileName:string) =
test headers "Return-Path: <ewrwe@werw.com>\n\twerwe\nDelivered-To: adfasdf@aasdfas.afa.com\n "
持续时间为:NilClass`。
NoMethodError: undefined method
方法类如下:
class AverageTimeForFirstReferralTest < ActiveSupport::TestCase
def setup
user1 = FactoryGirl.create(:user)
user2 = FactoryGirl.create(:user)
user2.referrer_id = user1.id
user2.created_at = 1.month.from_now
end
def test_creating_view_for_avg_time_for_first_ref
AverageTimeForFirstReferral.update_view_command();
assert_equal(1.month * 1.hour, AverageTimeForFirstReferral.first.duration)
end
end
答案 0 :(得分:0)
SQL语句不会在tableAi - unsigned bigint(20) - Auto increment index
loginDetails - varchar(200)
loginType - tinyint(4) (2- gmail, 3 facebook)
studentid - unsigned bigint(20)
tableAi | loginDetails | loginType | studentId
1 | abc@gmail.com | 2 | 333
2 | abc@facebook.com | 3 | 333
3 | xyz@facebook.com | 3 | 444
4 | xxx@gmail.com | 2 | 444
5 | test@gmail.com | 2 | 555
6 | abc@facebook.com | 3 | 555
7 | ac@facebook.com | 3 | 666
8 | ac@gmail.com | 2 | 777
9 | abc@facebook.com | 3 | 777
模型表创建任何记录。这就是原因。