2013-07-23 16 views
1
[email protected]:~/change/artfacedev2_15july$ bundle exec cucumber features/home_page.feature 
Using the default profile... 
Rack::File headers parameter replaces cache_control after Rack 1.5. 
Checking for old unconfirmed users 
2013-07-23 19:29:38 +0530 
Updating CurrencyValue 
2013-07-23 19:29:38 +0530 
Feature: homepage 

    Background: I am on the homepage # features/home_page.feature:3 
    Given I am on the homepage  # features/step_definitions/home_page_steps.rb:1 
     Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id (RuntimeError) 
     ./app/controllers/static_controller.rb:31:in `home' 
     ./features/step_definitions/home_page_steps.rb:2:in `/^I am on the homepage$/' 
     features/home_page.feature:4:in `Given I am on the homepage' 
"Exception" 
"undefined method `update_attribute' for nil:NilClass" 

.......................... 
in home_page.feature 
Feature: homepage 

    Background: I am on the homepage 
    Given I am on the homepage 
.......................... 
in home_page_step.rb 
Given /^I am on the homepage$/ do 
    visit "/" 
end 
........................... 
path.rb is 
module NavigationHelpers 
    def path_to(page_name) 
    case page_name 
    when /the homepage/ 
     '/' 
    when /users section in backend panel/ 
     '/backend/users/' 
    when /backend login page/ 
     '/backend/af_login/' 
    else 
     raise "Can't find mapping from \"#{page_name}\" to a path.\n" 
    end 
    end 
end 
World(NavigationHelpers) 

回答

0

線static_controller.rb的31呼籲id你希望成爲一個ActiveRecord對象的東西,但其實nil期間。找出原因。

(該錯誤消息指出nil,不會過分ActiveRecord對象,僅具有紅寶石內部id字段,這始終是4nil)。

+0

in static_controller.rb文件我hav包含空間電影的ID。 @header_movie = PAPERCLIP_STORAGE_PATH +「videos/header_movies /#{header_movie.id}/#{header_movie.header_movie_file_name}」 – manijain

+0

在這種情況下,Rails似乎在抱怨'header_movie'(_not_'@ header_movie')是'nil '。也許你從來沒有設置它?除非您可以將該方法發佈到static_controller.rb中,否則我無法再提供幫助。 – Chowlett

+0

但一旦我加載歡迎頁面,然後我得到一些MIME類型錯誤與視頻文件格式相關。 .......就像這樣...... 不支持「text/html」的HTTP「Content-Type」。媒體資源http:// localhost:3000/videos/header_movies/1/big-buck-bunny_trailer.webm的加載失敗。 PLZ指南爲這一個。 – manijain