Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix some specs

add stub for total_pages

use html_safe for some flash message
  • Loading branch information...
commit 241cdc43a489d911a92b7dca7d99cf97736bf9cb 1 parent 64734b3
@yaf yaf authored
Showing with 7 additions and 6 deletions.
  1. +2 −2 spec/helpers/application_helper_spec.rb
  2. +5 −4 spec/spec_helper.rb
View
4 spec/helpers/application_helper_spec.rb
@@ -14,8 +14,8 @@
end
it 'should render the notice and error flash' do
- flash[:notice] = 'good update'
- flash[:error] = "it's not good"
+ flash[:notice] = 'good update'.html_safe
+ flash[:error] = "it's not good".html_safe
render_flash.split("<br />\n").sort.should == ['<span class="error">it\'s not good</span>','<span class="notice">good update</span>']
end
end
View
9 spec/spec_helper.rb
@@ -115,7 +115,7 @@ def stub_pagination collection, attributes = {}
num_pages = length / per_page + (length % per_page == 0 ? 0 : 1)
attributes = attributes.reverse_merge current_page: 1, num_pages: num_pages,
- total_count: length, limit_value: per_page
+ total_count: length, limit_value: per_page, total_pages: 12
attributes.each do |key, value|
collection.stub(key).and_return value
end
@@ -127,9 +127,10 @@ def with_each_theme
yield nil, ""
Dir.new(File.join(::Rails.root.to_s, "themes")).each do |theme|
next if theme =~ /\.\.?/
- view_path = "#{::Rails.root.to_s}/themes/#{theme}/views"
- if File.exists?("#{::Rails.root.to_s}/themes/#{theme}/helpers/theme_helper.rb")
- require "#{::Rails.root.to_s}/themes/#{theme}/helpers/theme_helper.rb"
+ theme_dir = "#{::Rails.root.to_s}/themes/#{theme}"
+ view_path = "#{theme_dir}/views"
+ if File.exists?("#{theme_dir}/helpers/theme_helper.rb")
+ require "#{theme_dir}/helpers/theme_helper.rb"
end
yield theme, view_path
end
Please sign in to comment.
Something went wrong with that request. Please try again.