I''m having trouble getting the specs to run for a plugin where I want to fix a bug. (I''ve actually already found and fixed the bug, but I don''t want to submit a fix without a test!) When I started the specs weren''t running, but it may be that I''m using Rails 2.3.3 and the plugin has been tested on 2.1 and earlier. I went through writing a spec for a very simple plugin to get some perspective on how things fit together, and I''ve resolved some issues, but still see this error: $ spec vendor/plugins/openlaszlo_plugin/spec/swfobject_view_helper_spec.rb FFFFFFF 1) NoMethodError in ''ActionView::Helpers::SwfObjectHelper swfobject_tag should call swfobject.embedSWF'' undefined method `assert_select'' for #<ActiveSupport::TestCase::Subclass_1::Subclass_1:0x2281278> ./vendor/plugins/openlaszlo_plugin/spec/swfobject_view_helper_spec.rb:17: line 17 is: html.should have_tag(''script'', /swfobject.embedSWF/) Can anyone give me a hint? Thanks, Sarah -- Posted via http://www.ruby-forum.com/.
Sarah Allen wrote:> line 17 is: > html.should have_tag(''script'', /swfobject.embedSWF/)I order to use have_tag, it appears I have to include: # just enough infrastructure to get ''assert_select'' to work require ''action_controller'' require ''action_controller/assertions/selector_assertions'' include ActionController::Assertions::SelectorAssertions borrowed from: http://intertwingly.net/stories/2009/05/06/checkdepot.rb Odd, because it seems like this used to work without that in a previous version of Rails, but I would need to investigate more to isolate what went wrong. I figured I would go ahead and post this as something that works. Sarah -- Posted via http://www.ruby-forum.com/.
Sarah Allen wrote:> Sarah Allen wrote: >> line 17 is: >> html.should have_tag(''script'', /swfobject.embedSWF/) > > I order to use have_tag, it appears I have to include: > > # just enough infrastructure to get ''assert_select'' to work > require ''action_controller'' > require ''action_controller/assertions/selector_assertions'' > include ActionController::Assertions::SelectorAssertionsConfirmed that this is is required in Rails 2.3.2 and not in 2.1.0, although I still don''t understand why. Sarah -- Posted via http://www.ruby-forum.com/.
On Sat, May 23, 2009 at 3:00 PM, Sarah Allen <lists at ruby-forum.com> wrote:> Sarah Allen wrote: >> Sarah Allen wrote: >>> line 17 is: >>> ? ? ? html.should have_tag(''script'', /swfobject.embedSWF/) >> >> I order to use have_tag, it appears I have to include: >> >> # just enough infrastructure to get ''assert_select'' to work >> require ''action_controller'' >> require ''action_controller/assertions/selector_assertions'' >> include ActionController::Assertions::SelectorAssertions > > Confirmed that this is is required in Rails 2.3.2 and not in 2.1.0, > although I still don''t understand why.Me neither :) What version of rspec are you using?> > Sarah > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
David Chelimsky wrote:> What version of rspec are you using?1.2.6 -- Posted via http://www.ruby-forum.com/.
Sarah Allen wrote:> Sarah Allen wrote: >> line 17 is: >> html.should have_tag(''script'', /swfobject.embedSWF/) > > I order to use have_tag, it appears I have to include: > > # just enough infrastructure to get ''assert_select'' to work > require ''action_controller'' > require ''action_controller/assertions/selector_assertions'' > include ActionController::Assertions::SelectorAssertionsI just worked on this a bit with RailsBridge mentor, Zach Moazeni, who figured out that the problem was that I had not specifies a type for my view helper example group: describe SwfObjectHelper, :type => :helper do I thought I would post it here in case anyone else runs into the same issue. Sarah -- Posted via http://www.ruby-forum.com/.
On Sun, May 24, 2009 at 3:20 PM, Sarah Allen <lists at ruby-forum.com> wrote:> Sarah Allen wrote: >> Sarah Allen wrote: >>> line 17 is: >>> ? ? ? html.should have_tag(''script'', /swfobject.embedSWF/) >> >> I order to use have_tag, it appears I have to include: >> >> # just enough infrastructure to get ''assert_select'' to work >> require ''action_controller'' >> require ''action_controller/assertions/selector_assertions'' >> include ActionController::Assertions::SelectorAssertions > > I just worked on this a bit with RailsBridge mentor, Zach Moazeni, who > figured out that the problem was that I had not specifies a type for my > view helper example group: > > describe SwfObjectHelper, :type => :helper doFYI - if you put this file in spec/helpers/swf_object_helper_spec.rb, then :type => :helper is implied, so you don''t have to make it explicit. Cheers, David> > I thought I would post it here in case anyone else runs into the same > issue. > > Sarah > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
David Chelimsky wrote:> FYI - if you put this file in spec/helpers/swf_object_helper_spec.rb, > then :type => :helper is implied, so you don''t have to make it > explicit.Nice. By the way, I''ve been enjoying The RSpec Book, but it looks like I had to figure out view helpers before that chapter was ready. Thank for your help on this list! Sarah -- Posted via http://www.ruby-forum.com/.
David Chelimsky wrote:> FYI - if you put this file in spec/helpers/swf_object_helper_spec.rb, > then :type => :helper is implied, so you don''t have to make it > explicit.just curious... are there any other magic directories I should know about? Thanks, Sarah -- Posted via http://www.ruby-forum.com/.
On Sun, May 24, 2009 at 7:38 PM, Sarah Allen <lists at ruby-forum.com> wrote:> David Chelimsky wrote: >> FYI - if you put this file in spec/helpers/swf_object_helper_spec.rb, >> then :type => :helper is implied, so you don''t have to make it >> explicit. > > just curious... are there any other magic directories I should know > about?All directories under spec/ are potentially magic - rspec will always look at spec/:directory/:filename and see if it has an example group type registered for whatever directory is. So if there *is* a foo example group type, it will be used for any spec file in spec/foos. rspec-rails uses that feature of rspec to implicitly load custom groups for models, views, controllers and helpers in spec/models, spec/views, spec/controllers and spec/helpers. Cheers, David> > Thanks, > Sarah > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >