我想为我的应用程序编写测试,虽然每次看一下rspec.info,我都没有看到一条明确的路径,可以采取"做正确的事情"并首先进行测试.我在rspec上观看了不止一次的peepcode视频,但却没有.我想对我的工作感到更自豪,我认为测试会有所帮助.我怎样才能突破这个心理障碍?
对于以下标题,我在所有站点地图上都会遇到相同的两个错误.这很令人困惑,因为如果Google无法读取我的站点地图,那么他们怎么能说每个URL都具有相同的优先级呢?在XML声明之后,标头计为第2行.谷歌只声称从地图中索引了大约2%的网址.请帮忙.
更新:我认为问题是我不知道如何验证模式.怎么做?
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
==Parsing error
We were unable to read your Sitemap. It may contain an entry we are
unable to recognize. Please validate your Sitemap before resubmitting.
==Notice
All the URLs in your Sitemap have the same priority...
Run Code Online (Sandbox Code Playgroud)
更新:请耐心等待,第一次验证XML.我不明白这些错误.
Errors in the XML document:
4: 80 SchemaLocation: schemaLocation value = 'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd' must have even number of URI's.
4: 80 cvc-elt.1: Cannot find the declaration of element 'urlset'.
XML document:
1 <?xml version="1.0" encoding="UTF-8"?>
2 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" …Run Code Online (Sandbox Code Playgroud) 我在Nginx服务器下运行两个mongrels.我不断收到不存在文件的请求.IP地址经常更改,但引用URL保持不变.我想解决这个问题.
如何让to_param方法始终提供关键字slug?我无法使用此路线:
map.pike'/ auction /:auction_id/item /:id',: controller =>'items',:action =>'show'
早先被覆盖的to_param正在努力
"项目/ 1-绒围巾"
但失败了 'auction/123/item/1'
更新:
我不确定语法是否正确[(编辑:它是正确的:它可以:-)],甚至是高效....但是使用haml,我发现以下代码可以生成所需的链接('拍卖/:auction_id /项目/:身份证')
- for auction in @auctions.sort{|a, b| a.scheduled_start <=> b.scheduled_start}
-for item in @items
- unless auction.current_auction
... pike_path(auction.auction_id, item)
Run Code Online (Sandbox Code Playgroud) 我很困惑如何做到这一点.
我需要获取一个日期时间对象,并以小时,天,等等的形式获得当前时间.
谢谢.
我正在编写一个带有MySQL表的应用程序,该表可以索引3列.我担心在表达到大量记录后,保存新记录的时间会很慢.请告知如何最好地接近列的索引.
UPDATE
我正在索引一个point_value,user_id和一个event_id,这些都是面向客户端所需的.对于诸如通过玩家ID和游戏ID对棒球运行进行评分的实例.在该表保存了两个赛季的记录,比如72,000次运行之后,以及在5个赛季之后,可能有25万个记录,那么每天插入大约200条新记录的成本是多少?仅用于说明,但我希望每天插入25到200条记录.
问题:
edited files on windows, using git-bash, to fix IE7 problems
committed, pushed to github repo
booted back into linux
pulled from repo
merge conflict in dozens of files
used 'git reset --hard'
Run Code Online (Sandbox Code Playgroud)
我该怎样做才能回到正轨?
更新:请查看以下内容以获得更清晰的图片(不讽刺)
(我认为问题是我经常遇到的问题,sphinx文件是依赖于平台的,我不知道如何在拉动中跳过它们.)
jess@home:~$ cd Rails/nutrograph/
jess@home:~/Rails/nutrograph$ git rm nutrograph/
fatal: pathspec 'nutrograph/' did not match any files
jess@home:~/Rails/nutrograph$ git pull
remote: Counting objects: 29, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 15 (delta 11), reused 0 (delta 0)
Unpacking objects: 100% (15/15), done.
From …Run Code Online (Sandbox Code Playgroud) 对不起,但这开始感觉就像在踢脑袋一样.我完全被RSpec困惑了.在视频之后观看了视频,在教程之后阅读了教程,但我仍然只是停留在正方形.
===这是我正在使用的
http://github.com/fudgestudios/bort/tree/master
===错误
F
1)
NoMethodError in 'bidding on an item should work'
You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.new_record?
spec/controllers/auction_controller_spec.rb:16:
spec/controllers/auction_controller_spec.rb:6:
Finished in 0.067139 seconds
1 example, 1 failure
Run Code Online (Sandbox Code Playgroud)
===这是我的控制器动作
def bid
@bid = Bid.new(params[:bid])
@bid.save
end
Run Code Online (Sandbox Code Playgroud)
===这是我的考试
require File.dirname(__FILE__) + '/../spec_helper'
include ApplicationHelper
include UsersHelper
include AuthenticatedTestHelper
describe "bidding on an item" do
controller_name :items
before(:each) do
@user = mock_user …Run Code Online (Sandbox Code Playgroud)