2010-06-25 14 views
5

यह सुनिश्चित नहीं है कि यह रेल 3 अंक या आरएसपीईसी 2 मुद्दा है, लेकिन मुझे मानक नियंत्रक परीक्षण काम नहीं मिल रहा है - ऐसा लगता है कि 'मिल' विधि नहीं मिल सकती है। एक कि है -आरएसपीसी 2 और किनारे रेल के साथ काम कर रहे नियंत्रक परीक्षण नहीं प्राप्त कर सकते हैं 0

require 'spec_helper' 

describe DiscrepanciesController do 
    before :each do 
    Discrepancy.delete_all 
    end 

    it "resolves a discrepancy" do 
discrepancy = Discrepancy.create(:my_number=>"12345", :status=>"Open") 

get :resolve, :id => discrepancy.id 

retrieved_discrepancy = Discrepancy.find_by_my_number("12345") 
retrieved_discrepancy.status.should == "Resolved" 
    end 
end 

(हाँ, मैं के साथ एक HTTP/प्राप्त डेटा को संशोधित करने की सुरक्षा के प्रभाव के बारे में पता कर रहा हूँ:

मैं एक नियंत्रक परीक्षण है कि इस (spec/controllers निर्देशिका में discrepancies_controller_spec.rb नाम) की तरह लग रहा है अलग मुद्दे ...)

जब मैंने इसे रेक के साथ चलाने के लिए, मैं निम्नलिखित त्रुटि मिलती है:

1) DiscrepanciesController resolves a discrepanc 
    Failure/Error: Unable to find C to read failed line 
    undefined method `get' for #<RSpec::Core::ExampleGroup::Nested_1:0xc9170d0 @__memoized={}> 
    # ./spec/controllers/discrepancies_controller_spec.rb:38 (ignore the line number, commented out code was removed from the sample) 
    # C:/Users/Patrick_Gannon/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:212:in `inject' 
    # C:/Ruby187/bin/rake:19:in `load' 
    # C:/Ruby187/bin/rake:19 

मैं नियंत्रक कार्रवाई परीक्षण करने के लिए प्रबंधन कर सकते हैं नियंत्रक को तुरंत चालू करके और सीधे नियंत्रक कार्रवाई को कॉल करके, और यह काम करता है, लेकिन इसकी बदसूरत क्योंकि मुझे respond_to और params जैसी चीज़ों का नकल करना होगा।

अन्य प्रासंगिक जानकारी: मैं विंडोज 7 32-बिट, रुबी 1.8.7 (2010-01-10 पैचलेवल 24 9) [i386-wingw32], एज रेल 3 और मोंगोडीबी/मोंगोमैपर चला रहा हूं। यहाँ स्थापित जवाहरात की मेरी सूची है (के माध्यम से 'बंडल मणि' - मेरे सभी स्थापित जवाहरात Bundler द्वारा स्थापित किए गए थे)

  • सार (1.0.0)
  • ActionMailer (3.0.0.beta4)
  • actionpack (3.0.0.beta4)
  • activemodel (3.0.0.beta4)
  • ActiveRecord (3.0.0.beta4)
  • activeresource (3.0.0.beta4)
  • activesupport (3.0.0.beta4)
  • अरेल (0.4.0)
  • bcrypt-माणिक (2.1.2)
  • bson (1.0.3)
  • bson_ext (1.0.1)
  • बिल्डर (2.1.2)
  • बंडलर (0.9.26)
  • Capistrano (2.5.19)
  • capybara (0.3.8 a94f99)
  • ककड़ी (0.8.3)
  • ककड़ी-रेल (0.3.2 गुरु-ख 75110)
  • culerity (0.2.10)
  • database_cleaner (0.5.2 7ea99d)
  • वसीयत (1.1.rc1 88ab2f)
  • diff-LCS (1.1.2)
  • erubis (2.6.5)
  • factory_girl (1.3.0)
  • factory_girl_rails (1,0)
  • ठग (0.3.1)
  • ffi (0.6.3)
  • गेरकिन (2.0.2)
  • हाइलाइन (1.5।2)
  • i18n (0.4.1)
  • jnunemaker-validatable (1.8.4)
  • संयुक्त (0.3.2 11a094)
  • json_pure (1.4.3)
  • मेल (2.2.5)
  • माइम-प्रकार (1,16)
  • मोंगो (1.0.3)
  • mongo_mapper (0.8.2)
  • नेट SCP (1.0.2)
  • नेट SFTP (2.0.4)
  • नेट ssh (2.0.23)
  • नेट ssh-प्रवेश द्वार (1.0.1)
  • nokogiri (1.4.2.1)
  • हिम्मती (0.3.2)
  • बहुभाषी (0.3.1)
  • रैक (1.1.0)
  • रैक-माउंट (0.6.6)
  • रैक परीक्षण (0.5.4)
  • रेल (3.0.0। बीटा 4 6682cc)
  • ,210
  • railties (3.0.0.beta4)
  • रेक (0.8.7)
  • rspec (2.0.0.beta.13)
  • rspec कोर (2.0.0.beta.13)
  • rspec-उम्मीदों (2.0.0.beta.13)
  • rspec-mocks (2.0.0.beta.13)
  • rspec-रेल (2.0.0.beta.13)
  • सेलेनियम-webdriver (0.0 .24)
  • टर्म-ansicolor (1.0.5)
  • थोर (0.13.6)
  • पेड़ों (1.4.8)
  • पतुरिया (1.16.2)
  • tzinfo (0.3.22)
  • छड़ी (0.2.1)
  • वार्डन (0.10। 7)
  • webrat (0.7.1)

मैं भी एक परीक्षण में बयान डालता है यह जान सकें कि तरीकों परीक्षण स्थिरता ((methods - Object.methods).sort.inspect) में उपलब्ध हैं, और "मिल" सूची में नहीं है गयी। यहाँ सूची में है:

"__memoized", "__should_for_example_group__", "__should_not_for_example_group__", "_fixture_class_names", "_fixture_path", "_fixture_table_names", "_pre_loaded_fixtures", "_setup_mocks", "_teardown_mocks", "_use_instantiated_fixtures", "_use_transactional_fixtures", "_verify_mocks", "a_kind_of", "allow_message_expectations_on_nil", "an_instance_of", "any_args", "anything", "assert", "assert_block", "assert_equal", "assert_in_delta", "assert_instance_of", "assert_kind_of", "assert_match", "assert_nil", "assert_no_match", "assert_not_equal", "assert_not_nil", 
"assert_not_same", "assert_nothing_raised", "assert_nothing_thrown", "assert_operator", "assert_raise", "assert_raises", "assert_respond_to", "assert_same", "assert_send", "assert_throws", "be", "be_a", "be_a_kind_of", "be_a_new", "be_an", "be_an_instance_of", "be_close", "be_false", "be_instance_of", "be_kind_of", "be_nil", "be_true", "boolean", "build_message", "change", "described_class", "double", "duck_type", "eq", "eql", "equal", "example", "example=", "exist", "expect", "fixture_class_names", "fixture_class_names?", "fixture_path", "fixture_path?", "fixture_table_names", 
"fixture_table_names?", "flunk", "hash_including", "hash_not_including", "have", "have_at_least", "have_at_most", "have_exactly", "include", "instance_of", "kind_of", "match", "method_missing", "method_name", "mock", "mock_discrepancy", "mock_model", "no_args", "pending", "pre_loaded_fixtures", "pre_loaded_fixtures?", "raise_error", "respond_to", "run_in_transaction?", "running_example", "satisfy", "setup_fixtures", "stub_model", "subject", "teardown_fixtures", "throw_symbol", "use_instantiated_fixtures", "use_instantiated_fixtures?", "use_transactional_fixtures", "use_transactional_fixtures?" 

उत्तर

4

, डेविड Chelimsky से RSpec मेलिंग सूची पर इस का उत्तर मिल गया इस प्रकार है:

मैं यह पहली बार इस के साथ आ गया है हैरान हूँ rspec-2, लेकिन यहां हम हैं :)

यह एक पथ-विभाजक बग है जिसे मैं अगली रिलीज में हल करूंगा। अभी के लिए, आप इसे अपने कंट्रोलर चश्मे में कर सकते हैं:

describe DiscrepanciesController do 
    include RSpec::Rails::ControllerExampleGroup 

यह ठीक काम करना चाहिए।

आप एक अधिक वैश्विक वैकल्पिक हल करना चाहते हैं, अपने spec_helper config से जोड़ें:

RSpec.configure do |c| 
    c.include RSpec::Rails::ControllerExampleGroup, :example_group => { :file_path => /\bspec[\\\/]controllers[\\\/]/ } 
end 
संबंधित मुद्दे