I wrote *simple_form* input extension that is located in app/inputs/something_input.rb
I'm trying to write RSpec for this. When I put this spec inside spec/helpers/application_helper_spec.rb everything was working without single problem.
# 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
Now I'm trying to move that spec to spec/inputs/something_input_spec.rb so it will be similar name path.
# 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
the thing I want to tell RSpec to threat this file as type helper spec, so I will have helper method availible with all the RSpec::Rails::HelperExampleGroup functionality
... how can I do that ??
I was trying to extend/include it with RSpec::Rails::HelperExampleGroup nothing seems to work