similar to: Trying to test flash messaging with rspec

Displaying 20 results from an estimated 4000 matches similar to: "Trying to test flash messaging with rspec"

2010 May 17
6
Should an blank string be html_safe?
Just trying to implement a simple helper over the past few days had me really confused. messages = '''' messages << content_tag(:p, ''dave'') #=> &lt;p&gt;dave&lt;\p%;gt; Eventually I realised the original empty string was not html_safe message = ''''.html_safe message << content_tag(:p, ''dave'') #=>
2010 Aug 17
3
Rails 3 flash message problems
The following code in my application_helper.rb class either eats the flash message or escapes it and does not display properly: # Outputs the corresponding flash message if any are set def flash_messages messages = [] %w(notice warning error).each do |msg| messages << content_tag(:div, content_tag(:p, html_escape(flash[msg.to_sym])), :class => "message
2010 Nov 05
9
[patch] Let's use <%== %> instead of <%= raw() %>
I''ve submitted a small patch to make Rails behave properly with the Erubis <%== %> construct. For some reason the current behaviour of that tag in Rails 3 is to escape the contents _twice_ which is probably a bug. I offer three suggestions why this is a good idea: - The syntax is cleaner. It can avoid a lot of .html_safe and raw in your views. I especially like the conciseness of
2010 Aug 03
7
rails 2.3.8 and html_safe
Hi, Can somebody update me on the state of html_safe strings in rails 2.3.8? I know rails 2.3.6 and 2.3.7 broke a lot of code because strings were being escaped when they shouldn''t have been and I thought this was all fixed in 2.3.8. I''m upgrading an app from 2.3.5 to 2.3.8 and there are many spots where previous code was output correctly and now it expects html_safe method
2011 Nov 01
2
Railscast 262 different partial in helper
Hi RoR Community, in Ryan Bates Railscasts Episode #262 he put the index code <% for message in @messages %> <div class="message"> <div class="created_at"><%= message.created_at.strftime("%B %d, %Y") %></div> <div class="content"> <%= message.content %> </div> <div
2006 Jun 20
3
WEBrick just decided to take a hiatus on me
Good day all. This is one of the most frustrating days I have had with Rails in quite some time now (almost 8 months actually). Yesterday I complete my development and testing and everything is peachy. I head home for the evening and do my things there. This morning, I come back in and do my typical morning routine of starting up eclipse and the usual "ruby script/server" command in
2013 Nov 08
2
Export CSV
Hi friends, i am using csv export on my application. in my view file code is <%- headers = ["Transaction ID", "Activity ID", "Product Name","Customer Name", "Ticket code"] -%> <%= CSV.generate_line(headers).strip %> <%if !@trans.nil? && @trans.length > 0 %> <% @trans.each do |tran|%> <% if
2011 Feb 09
16
rails 3.0.4 broke yield :javascript ?
hello, I have today updated my rails app to 3.0.4 security release but now this yield :javascripts fails in the layout and I get my custom js escaped as text in the view. anybody seeing this also? tia, jk -- www.least-significant-bit.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to
2011 Jul 15
3
Ruby variable that embeds html tags
This seems very simple, but I can''t quite get it. Probably because I''m just starting out with RoR. My view has a slew of labels and text fields; many are "required": <%= f.text_field :screen_name %> <span class="required_field">Required field</span> (The "required_field" class turns the text red and smaller.) I''d like to
2010 Oct 01
8
field_with_errors.
If a model doesn''t pass validation the field in the view is put under a <div class="field_with_errors">. But who create that div? field_text helper do it? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2011 Aug 31
0
ERB and binding in template
How to get current binding in a partial (to use helpers and local variables in erb script)? When I invoke result whithout binding, = ERB.new("script").result.html_safe all work (without vars are needed), but when I write = ERB.new("script").result(binding).html_safe (in HAML HTML partial), THE PARTIAL''S REST OF OUTPUT IS CLEAR. What is the problem? -- Posted
2011 Jun 26
1
ActionView::Template::Error (Cannot modify SafeBuffer in place):
Hello, Trying to upgrade an app that was running fine in 3.0.3 to 3.0.9 and while everything works well, I get this error: ActionView::Template::Error (Cannot modify SafeBuffer in place): When passing a string to this function (in application_helper.rb) through a simple: <%= format_me(article[shortdesc])%> def format_me(text, html_options={}, options={}) text =
2006 Mar 25
7
Overriding <div class="fieldWithErrors">
Does anyone know how to override the <div class="fieldWithErrors"> behaviour when a form field is incorrect? Thanks, Dan
2010 Jul 27
13
3.0.0rc ActionController::RoutingError No route matches
Have been developing on 3.0.0beta4 and just updated to 3.0.0.rc. When I try to link_to() a User object that previously had worked, I get the following: ActionView::Template::Error (No route matches {:action=>"destroy", :controller=>"games", :id=>#<User ..... > Yet I have in my routes.rb file has resources :users and my "rake routes" shows:
2003 Dec 30
3
The dangers of static buffers in rsync code
I have been trying for quite a while now to understand why is the flist.c:f_name() function implemented using static buffers. Anyone care to comment? The immediate problem is that any call to f_name overrides the previous content (well, obvious). This, combined with the fact that several function calls are made with the result of f_name(file) results in problems handling hardlinks - and
2007 May 15
3
NOOB question RSPEC
Hi all !! I have this code: require ''account'' describe Account, "when first created" do before do @account = Account.new end it "should have a balance of $0" do @account.balance.should eql(Money.new(0, :dollars)) end after do @account = nil end end How can I pass the @account.balance.should eql(Money.new(0, :dollars)) spec. From my
2009 Aug 10
2
testing exception notification plugin with rspec
Hi, I''m trying to install exception notification plugin and test it with rspec. The problem that I have is that when running the server in production mode : at the end of the log i get this when I have a critical error rendering section "request" rendering section "session" rendering section "environment" rendering section "backtrace" Sent mail to
2008 Aug 20
2
Re: Stubbing out ThinkingSphinx for Rspec
Thanks Wolas! Sorry if this seems like a newbie question, what am I supposed replace the stubbed_method_name with? Also, I came across the only thread on the Interwebs which seems to cover this topic - it''s over a year old, but I think they have a solution which could work around the issues you pointed out. However, I couldn''t work out how to get their subbing approach to
2009 Oct 13
0
RSpec, flash messages and redirection
Hello everybody I''m having some problems with RSpec. 1) When using something like "I should see ''some text''" that text is set on a flash message in the controller and displayed by = flash[:notice] in the layout view, so the relevant part of my view says, in haml: .notice = flash[:notice] The rspec evaluation for that says: response.should
2006 Apr 21
9
Capistrano, OS X
If you installed your copy of ruby via DarwinPorts, the hashbang lines at the top of your dispatch.* scripts says "#!/opt/local/bin/ruby". This is a problem, if you''re deployin via Capistrano to a host with a different path to ruby (which would be practially all of them:-) Here''s a fix. Add this "fix_hashbangs.rb" script to your script directory.