【发布时间】:2010-08-14 21:10:07
【问题描述】:
带有 Rspec2 和 Cucumber 的 Rails3 应用
黄瓜
Given /^that a user is logged in$/ do
current_user = User.first
render new_user_post_path(current_user)
end
Routes.rb
map.resources :users do |users|
users.resources :posts, :collection => {:view => :get}
end
posts_controller_spec
describe PostsController do
describe "#new" do
it "should be successful" do
get :new
response.should be_success
end
end
end
我的第一个史诗般的失败
(::) failed steps (::)
No route matches {:controller=>"posts", :action=>"new"} (ActionController::RoutingError)
./features/step_definitions/tasklist_steps.rb:3:in `/^that a user is logged in$/'
features/tasklist.feature:7:in `Given that a user is logged in'
Failing Scenarios:
cucumber features/tasklist.feature:6 # Scenario: List SubmitLink
1 scenario (1 failed)
3 steps (1 failed, 2 skipped)
0m0.147s
rake aborted!
对不起,我太新了。这是我第一次尝试黄瓜。 :(
【问题讨论】:
标签: ruby-on-rails ruby rspec ruby-on-rails-3 cucumber