के साथ लोड नहीं हो रहा है, इसलिए, मैं रेल परियोजना के संदर्भ में आरएसपीसी बीडीडी परीक्षण ढांचे को सीखने की कोशिश कर रहा हूं। मेरी समस्या यह है कि मैं नहीं कर सकता, मेरे जीवन के लिए, मेरे फिक्स्चर आरएसपीईसी विवरणों में ठीक से लोड करने के लिए मिलता है।रेल फिक्स्चर आरएसपीईसी
अस्वीकरण: हां, उपयोग करने के लिए जुड़नार की तुलना में बेहतर चीजें हैं। मैं कारखाने-लड़की, मोचा, ऑटो-टेस्ट इत्यादि जैसे संबंधित उपकरणों के साथ खेलने से पहले, यहां एक समय में एक चीज़ सीखने की कोशिश कर रहा हूं, विशेष रूप से आरएसपीईसी) जैसे, मैं मृत-सरल पाने की कोशिश कर रहा हूं , अगर गुंजाइश, फिक्स्चर काम कर रहे हैं।
# password: "secret"
foo:
username: foo
email: [email protected]
password_hash: 3488f5f7efecab14b91eb96169e5e1ee518a569f
password_salt: bef65e058905c379436d80d1a32e7374b139e7b0
bar:
username: bar
email: [email protected]
password_hash: 3488f5f7efecab14b91eb96169e5e1ee518a569f
password_salt: bef65e058905c379436d80d1a32e7374b139e7b0
/spec/controllers/pages_controller_spec.rb - -
require 'spec/spec_helper'
describe PagesController do
integrate_views
fixtures :users
it "should render index template on index call when logged in" do
session[:user_id] = user(:foo).id
get 'index'
response.should render_template('index')
end
end
और क्या मैं
/test/fixtures/users.yml:
वैसे भी, यहाँ कोड है जब मैं 'रेक स्पेक' चलाता हूं तो मुझे मिल रहा है:
NoMethodError in 'PagesController should render index template on index call when logged in'
undefined method `user' for #<Spec::Rails::Example::ControllerExampleGroup::Subclass_1:0x2405a7c>
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/test_process.rb:511:in `method_missing'
./spec/controllers/pages_controller_spec.rb:7:
यही है, यह वैध विधि के रूप में 'उपयोगकर्ता (: foo)' को पहचान नहीं रहा है।
फिक्स्चर स्वयं ठीक होना चाहिए, क्योंकि जब मैं उन्हें 'रेक डीबी: फिक्स्चर: लोड' के माध्यम से विकास डीबी में लोड करता हूं, तो मैं सत्यापित कर सकता हूं कि उस डीबी में foo और bar मौजूद हैं।
मुझे लगता है कि मुझे यहां कुछ स्पष्ट याद आ रही है, लेकिन मैं अपने बालों को पूरे दिन बाहर नहीं निकाल रहा हूं। किसी भी सहायता की सराहना की जाएगी।
Damnit। खैर, मुझे यकीन था कि यह कुछ बेवकूफ था, और मैं बहुत सही था। धन्यवाद, यह हल हो गया। :) – Fishtoaster
@tadman क्या आप ऑनलाइन हैं? –