doug livesey
2010-Jul-08 09:29 UTC
[rspec-users] Accessing view helpers to spec cell views, Rails3, RSpec2
Hi -- I''m trying to use the excellent Cells <http://cells.rubyforge.org/> gem in a Rails 3 project with RSpec 2. I''ve got the ''controller'' bit of the cells specced okay, but I''m struggling with the ''view'' bit. What I want to do is to use RSpec''s view helper methods to render the views, but don''t know how to access them. I''ve tried declaring the spec like this: describe "tabs/show.html.haml", :type => :view do ... end This, however, still won''t give me access to the assign( key, value ) method, so I guess I''m still drawing a blank, there. Could someone advise me on how to access the view helpers in a spec that falls outside of the normal rails dir structure? (The actual path to the spec in question is "spec/cells/tabs/show.html.haml_spec.rb", and the file being specced is "app/cells/tabs/show.html.haml".) Thanks for any & all help, Doug. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100708/e018a36e/attachment.html>
David Chelimsky
2010-Jul-08 10:58 UTC
[rspec-users] Accessing view helpers to spec cell views, Rails3, RSpec2
On Jul 8, 2010, at 4:29 AM, doug livesey wrote:> Hi -- I''m trying to use the excellent Cells gem in a Rails 3 project with RSpec 2. > I''ve got the ''controller'' bit of the cells specced okay, but I''m struggling with the ''view'' bit. > What I want to do is to use RSpec''s view helper methods to render the views, but don''t know how to access them. > I''ve tried declaring the spec like this: > describe "tabs/show.html.haml", :type => :view do:type => xxx isn''t directly supported yet (not sure if it will be or not), but you can use it yourself and then do this in your spec_helper: RSpec.configure do |c| c.include RSpec::Rails::ViewExampleGroup, :type => :view end HTH, David> ... > end > > This, however, still won''t give me access to the assign( key, value ) method, so I guess I''m still drawing a blank, there. > Could someone advise me on how to access the view helpers in a spec that falls outside of the normal rails dir structure? > (The actual path to the spec in question is "spec/cells/tabs/show.html.haml_spec.rb", and the file being specced is "app/cells/tabs/show.html.haml".) > Thanks for any & all help, > Doug.-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100708/c8437d06/attachment.html>
doug livesey
2010-Jul-08 12:14 UTC
[rspec-users] Accessing view helpers to spec cell views, Rails3, RSpec2
Perfect, thankyou! :) On 8 July 2010 11:58, David Chelimsky <dchelimsky at gmail.com> wrote:> On Jul 8, 2010, at 4:29 AM, doug livesey wrote: > > Hi -- I''m trying to use the excellent Cells <http://cells.rubyforge.org/> gem > in a Rails 3 project with RSpec 2. > I''ve got the ''controller'' bit of the cells specced okay, but I''m struggling > with the ''view'' bit. > What I want to do is to use RSpec''s view helper methods to render the > views, but don''t know how to access them. > I''ve tried declaring the spec like this: > describe "tabs/show.html.haml", :type => :view do > > > :type => xxx isn''t directly supported yet (not sure if it will be or not), > but you can use it yourself and then do this in your spec_helper: > > RSpec.configure do |c| > c.include RSpec::Rails::ViewExampleGroup, :type => :view > end > > HTH, > David > > ... > end > > This, however, still won''t give me access to the assign( key, value ) > method, so I guess I''m still drawing a blank, there. > Could someone advise me on how to access the view helpers in a spec that > falls outside of the normal rails dir structure? > (The actual path to the spec in question is > "spec/cells/tabs/show.html.haml_spec.rb", and the file being specced is > "app/cells/tabs/show.html.haml".) > Thanks for any & all help, > Doug. > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100708/0db9862b/attachment-0001.html>