Permalink
Browse files

spec:models pass with ruby 1.9.2. Using the stringex gem for translit…

…eration, fixed cucumber.yml, fixed Radiant::Config handling of boolean values. Fixes GH-279. Fixes GH-276.

Conflicts:

	Gemfile.lock
	radiant.gemspec
  • Loading branch information...
1 parent e4c9761 commit d3c478a72efaeab6d1c4bd5677542cafcf4732a7 @jfahrenkrug jfahrenkrug committed with johnmuhl Oct 20, 2011
@@ -13,7 +13,7 @@ def allowed_children
page type.
}
- tag "attempted_url" do
+ tag "attempted_url" do |tag|
CGI.escapeHTML(request.request_uri) unless request.nil?
end
@@ -237,7 +237,7 @@ def value=(param)
if newvalue != self[:value]
raise ConfigError, "#{self.key} cannot be changed" unless settable? || self[:value].blank?
if boolean?
- self[:value] = (newvalue == "0" || newvalue == "false" || newvalue.blank? ) ? "false" : "true"
+ self[:value] = (newvalue == "1" || newvalue == "true") ? "true" : "false"
else
self[:value] = newvalue
end
@@ -364,7 +364,7 @@ class RequiredAttributeError < StandardError; end
tag.locals.page = aggregate_page
aggregates << tag.expand
end
- aggregates
+ aggregates.flatten.join('')
end
tag "aggregate:each:children" do |tag|
@@ -382,7 +382,7 @@ class RequiredAttributeError < StandardError; end
tag.locals.page = item
result << tag.expand
end
- result
+ result.flatten.join('')
end
tag "aggregate:children" do |tag|
@@ -1235,7 +1235,7 @@ def render_children_with_pagination(tag, opts={})
tag.locals.paginated_list = displayed_children
result << tag.render('pagination', tag.attr.dup)
end
- result
+ result.flatten.join('')
end
def children_find_options(tag)
View
@@ -1,7 +1,7 @@
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format progress features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
-std_opts = "#{rerun_opts} --format rerun --out rerun.txt --strict --tags ~@wip"
+std_opts = "#{rerun_opts} --format rerun --out rerun.txt --strict --require features --tags ~@wip"
%>
default: <%= std_opts %>
wip: --tags @wip:3 --wip features
@@ -1,3 +1,5 @@
+require 'stringex'
+
class String
def symbolize
self.gsub(/[^A-Za-z0-9]+/, "_").gsub(/(^_+|_+$)/, "").underscore.to_sym
@@ -13,7 +15,7 @@ def to_name(last_part = '')
unless methods.include?('parameterize')
def parameterize(sep = '-')
- ActiveSupport::Inflector.parameterize(self, sep)
+ remove_formatting.downcase.replace_whitespace(sep).collapse(sep)
end
end
@@ -53,8 +53,8 @@ def page_part_params(attributes={})
end
private
- @@unique_page_title_call_count = 0
def unique_page_title
+ @@unique_page_title_call_count ||= 0
@@unique_page_title_call_count += 1
"Page #{@@unique_page_title_call_count}"
end
@@ -49,8 +49,8 @@ def get_test_layout(name = @layout_name)
private
- @@unique_layout_name_call_count = 0
def unique_layout_name
+ @@unique_layout_name_call_count ||= 0
@@unique_layout_name_call_count += 1
"Layout #{@@unique_layout_name_call_count}"
end
@@ -28,8 +28,8 @@ def snippet_params(attributes={})
private
- @@unique_snippet_name_call_count = 0
def unique_snippet_name
+ @@unique_snippet_name_call_count ||= 0
@@unique_snippet_name_call_count += 1
"snippet-#{@@unique_snippet_name_call_count}"
end
View
@@ -11,11 +11,11 @@ def headers
}
end
- tag 'test1' do
+ tag 'test1' do |tag|
'Hello world!'
end
- tag 'test2' do
+ tag 'test2' do |tag|
'Another test.'
end
end
@@ -916,7 +916,9 @@
end
it "set to a malformatted regexp should render an error" do
- page.should render('<r:if_path matches="as(sorted/$">true</r:if_path>').with_error("Malformed regular expression in `matches' argument of `if_path' tag: unmatched (: /as(sorted\\/$/")
+ expected_error = "Malformed regular expression in `matches' argument of `if_path' tag: " + (RUBY_VERSION =~ /^1\.9/ ? "end pattern with unmatched parenthesis: /as(sorted\\/$/i" : "unmatched (: /as(sorted\\/$/")
+
+ page.should render('<r:if_path matches="as(sorted/$">true</r:if_path>').with_error(expected_error)
end
it "without 'ignore_case' attribute should ignore case by default" do
@@ -950,7 +952,9 @@
end
it "set to a malformatted regexp should render an error" do
- page.should render('<r:unless_path matches="as(sorted/$">true</r:unless_path>').with_error("Malformed regular expression in `matches' argument of `unless_path' tag: unmatched (: /as(sorted\\/$/")
+ expected_error = "Malformed regular expression in `matches' argument of `unless_path' tag: " + (RUBY_VERSION =~ /^1\.9/ ? "end pattern with unmatched parenthesis: /as(sorted\\/$/i" : "unmatched (: /as(sorted\\/$/")
+
+ page.should render('<r:unless_path matches="as(sorted/$">true</r:unless_path>').with_error(expected_error)
end
it "without 'ignore_case' attribute should ignore case by default" do

0 comments on commit d3c478a

Please sign in to comment.