app / input/something_input.rbにある*simple_form*入力拡張機能を作成しました
このためにRSpecを作成しようとしています。この仕様をspec/helpers / application_helper_spec.rb内に置くと、すべてが問題なく機能していました。
# spec/helpers/application_helper_spec.rb
require 'spec_helper'
describe ApplicationHelper do
it do
helper.simple_form_for @foo,:method=>'get', :url=>helper.users_path do |f|
f.input :created_at, :as =>:custom_datepicker
end.should =~ /something/
end
end
今、私はそのスペックをspec / input / something_input_spec.rbに移動しようとしているので、同じような名前のパスになります。
# spec/imputs/something_input_spec.rb
require 'spec_helper'
describe SomethingInput do
it do
helper.simple_form_for @foo,:method=>'get', :url=>helper.users_path do |f|
f.input :created_at, :as =>:custom_datepicker
end.should =~ /something/
end
end
#
#ERROR: undefined local variable or method `helper' for #<RSpec::Core::ExampleGroup
このファイルをタイプヘルパー仕様として脅かすようにRSpecに伝えたいので、すべてのRSpec :: Rails::HelperExampleGroup機能でヘルパーメソッドを使用できるようにします。
... どうやってやるの ??
RSpec :: Rails::HelperExampleGroupで拡張/インクルードしようとしましたが何も機能しないようです