| |   |
| 14 | 14 | # Full error reports are disabled and caching is turned on |
| 15 | 15 | config.action_controller.consider_all_requests_local = false |
| 16 | 16 | config.action_controller.perform_caching = true |
| 17 | | config.action_view.cache_template_extensions = true |
| 18 | 17 | |
| 19 | 18 | cache_dir = File.expand_path(File.join(RAILS_ROOT, 'public', 'cache')) |
| 20 | 19 | config.action_controller.page_cache_directory = cache_dir |
| toggle raw diff |
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -14,7 +14,6 @@ config.log_level = :warn
# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
-config.action_view.cache_template_extensions = true
cache_dir = File.expand_path(File.join(RAILS_ROOT, 'public', 'cache'))
config.action_controller.page_cache_directory = cache_dir |
| |   |
| 4 | 4 | |
| 5 | 5 | it "renders a message if an object is not ready?" do |
| 6 | 6 | repos = repositories(:johans) |
| 7 | | build_notice_for(repos).should include("This repository is being created") |
| 7 | helper.build_notice_for(repos).should include("This repository is being created") |
| 8 | 8 | end |
| 9 | 9 | |
| 10 | 10 | it "renders block if object is ready" do |
| 11 | 11 | obj = mock("any given object") |
| 12 | 12 | obj.stub!(:ready?).and_return(true) |
| 13 | | render_if_ready(obj) do |
| 13 | helper.render_if_ready(obj) do |
| 14 | 14 | "moo" |
| 15 | 15 | end.should == "moo" |
| 16 | 16 | end |
| … | … | |
| 19 | 19 | obj = mock("any given object") |
| 20 | 20 | obj.stub!(:ready?).and_return(false) |
| 21 | 21 | _erbout = "" # damn you RSpec! |
| 22 | | render_if_ready(obj) do |
| 22 | helper.render_if_ready(obj) do |
| 23 | 23 | "moo" |
| 24 | 24 | end |
| 25 | 25 | _erbout.should_not == "moo" |
| … | … | |
| 27 | 27 | end |
| 28 | 28 | |
| 29 | 29 | it "gives us the domain of a full url" do |
| 30 | | base_url("http://foo.com").should == "foo.com" |
| 31 | | base_url("http://www.foo.com").should == "www.foo.com" |
| 32 | | base_url("http://foo.bar.baz.com").should == "foo.bar.baz.com" |
| 33 | | base_url("http://foo.com/").should == "foo.com" |
| 34 | | base_url("http://foo.com/bar/baz").should == "foo.com" |
| 30 | helper.base_url("http://foo.com").should == "foo.com" |
| 31 | helper.base_url("http://www.foo.com").should == "www.foo.com" |
| 32 | helper.base_url("http://foo.bar.baz.com").should == "foo.bar.baz.com" |
| 33 | helper.base_url("http://foo.com/").should == "foo.com" |
| 34 | helper.base_url("http://foo.com/bar/baz").should == "foo.com" |
| 35 | 35 | end |
| 36 | 36 | |
| 37 | 37 | it "generates a valid gravatar url" do |
| 38 | 38 | email = "someone@myemail.com"; |
| 39 | 39 | url = gravatar_url_for(email) |
| 40 | 40 | |
| 41 | | base_url(url).should == "www.gravatar.com" |
| 41 | helper.base_url(url).should == "www.gravatar.com" |
| 42 | 42 | url.include?(Digest::MD5.hexdigest(email)).should == true |
| 43 | 43 | url.include?("avatar.php?").should == true |
| 44 | 44 | end |
| … | … | |
| 46 | 46 | |
| 47 | 47 | it "should generate a blank commit graph url if the graph isn't there" do |
| 48 | 48 | File.should_receive(:exist?).and_return(false) |
| 49 | | url = commit_graph_tag(repositories(:johans)) |
| 49 | url = helper.commit_graph_tag(repositories(:johans)) |
| 50 | 50 | url.should == nil |
| 51 | 51 | end |
| 52 | 52 | |
| 53 | 53 | it "should generate a blank url for commit graph by author if the graph isn't there" do |
| 54 | 54 | File.should_receive(:exist?).and_return(false) |
| 55 | 55 | |
| 56 | | url = commit_graph_by_author_tag(repositories(:johans)) |
| 56 | url = helper.commit_graph_by_author_tag(repositories(:johans)) |
| 57 | 57 | url.should == nil |
| 58 | 58 | end |
| 59 | 59 | end |
| toggle raw diff |
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -4,13 +4,13 @@ describe ApplicationHelper do
it "renders a message if an object is not ready?" do
repos = repositories(:johans)
- build_notice_for(repos).should include("This repository is being created")
+ helper.build_notice_for(repos).should include("This repository is being created")
end
it "renders block if object is ready" do
obj = mock("any given object")
obj.stub!(:ready?).and_return(true)
- render_if_ready(obj) do
+ helper.render_if_ready(obj) do
"moo"
end.should == "moo"
end
@@ -19,7 +19,7 @@ describe ApplicationHelper do
obj = mock("any given object")
obj.stub!(:ready?).and_return(false)
_erbout = "" # damn you RSpec!
- render_if_ready(obj) do
+ helper.render_if_ready(obj) do
"moo"
end
_erbout.should_not == "moo"
@@ -27,18 +27,18 @@ describe ApplicationHelper do
end
it "gives us the domain of a full url" do
- base_url("http://foo.com").should == "foo.com"
- base_url("http://www.foo.com").should == "www.foo.com"
- base_url("http://foo.bar.baz.com").should == "foo.bar.baz.com"
- base_url("http://foo.com/").should == "foo.com"
- base_url("http://foo.com/bar/baz").should == "foo.com"
+ helper.base_url("http://foo.com").should == "foo.com"
+ helper.base_url("http://www.foo.com").should == "www.foo.com"
+ helper.base_url("http://foo.bar.baz.com").should == "foo.bar.baz.com"
+ helper.base_url("http://foo.com/").should == "foo.com"
+ helper.base_url("http://foo.com/bar/baz").should == "foo.com"
end
it "generates a valid gravatar url" do
email = "someone@myemail.com";
url = gravatar_url_for(email)
- base_url(url).should == "www.gravatar.com"
+ helper.base_url(url).should == "www.gravatar.com"
url.include?(Digest::MD5.hexdigest(email)).should == true
url.include?("avatar.php?").should == true
end
@@ -46,14 +46,14 @@ describe ApplicationHelper do
it "should generate a blank commit graph url if the graph isn't there" do
File.should_receive(:exist?).and_return(false)
- url = commit_graph_tag(repositories(:johans))
+ url = helper.commit_graph_tag(repositories(:johans))
url.should == nil
end
it "should generate a blank url for commit graph by author if the graph isn't there" do
File.should_receive(:exist?).and_return(false)
- url = commit_graph_by_author_tag(repositories(:johans))
+ url = helper.commit_graph_by_author_tag(repositories(:johans))
url.should == nil
end
end |
| |   |
| 2 | 2 | |
| 3 | 3 | describe BlobsHelper do |
| 4 | 4 | |
| 5 | def included_modules |
| 6 | (class << helper; self; end).send(:included_modules) |
| 7 | end |
| 8 | |
| 5 | 9 | it "includes the RepostoriesHelper" do |
| 6 | | self.class.ancestors.should include(RepositoriesHelper) |
| 10 | included_modules.should include(RepositoriesHelper) |
| 7 | 11 | end |
| 8 | 12 | |
| 9 | 13 | it "includes the TreesHelper" do |
| 10 | | self.class.ancestors.should include(TreesHelper) |
| 11 | | end |
| 14 | included_modules.should include(TreesHelper) |
| 15 | end |
| 12 | 16 | |
| 13 | 17 | describe "line_numbers_for" do |
| 14 | 18 | it "renders something with line numbers" do |
| 15 | | numbered = line_numbers_for("foo\nbar\nbaz") |
| 19 | numbered = helper.line_numbers_for("foo\nbar\nbaz") |
| 16 | 20 | numbered.should include(%Q{<td class="line-numbers"><a href="#line2" name="line2">2</a></td>}) |
| 17 | 21 | numbered.should include(%Q{<td class="code">bar</td>}) |
| 18 | 22 | end |
| 19 | 23 | |
| 20 | 24 | it "renders one line with line numbers" do |
| 21 | | numbered = line_numbers_for("foo") |
| 25 | numbered = helper.line_numbers_for("foo") |
| 22 | 26 | numbered.should include(%Q{<td class="line-numbers"><a href="#line1" name="line1">1</a></td>}) |
| 23 | 27 | numbered.should include(%Q{<td class="code">foo</td>}) |
| 24 | 28 | end |
| 25 | 29 | |
| 26 | 30 | it "doesn't blow up when with_line_numbers receives nil" do |
| 27 | 31 | proc{ |
| 28 | | line_numbers_for(nil).should == %Q{<table id="codeblob" class="highlighted">\n</table>} |
| 32 | helper.line_numbers_for(nil).should == %Q{<table id="codeblob" class="highlighted">\n</table>} |
| 29 | 33 | }.should_not raise_error |
| 30 | 34 | end |
| 31 | 35 | end |
| … | … | |
| 37 | 37 | describe "render_highlighted()" do |
| 38 | 38 | it "tries to figure out the filetype" do |
| 39 | 39 | Uv.should_receive(:syntax_names_for_data).with("foo.rb", "puts 'foo'").and_return(["ruby"]) |
| 40 | | render_highlighted("puts 'foo'", "foo.rb") |
| 40 | helper.render_highlighted("puts 'foo'", "foo.rb") |
| 41 | 41 | end |
| 42 | 42 | |
| 43 | 43 | it "parses the text" do |
| 44 | 44 | Uv.should_receive(:syntax_names_for_data).with("foo.rb", "puts 'foo'").and_return(["ruby"]) |
| 45 | 45 | Uv.should_receive(:parse).and_return("puts 'foo'") |
| 46 | | render_highlighted("puts 'foo'", "foo.rb") |
| 46 | helper.render_highlighted("puts 'foo'", "foo.rb") |
| 47 | 47 | end |
| 48 | 48 | |
| 49 | 49 | it "adds linenumbers" do |
| 50 | | should_receive(:line_numbers_for).and_return(123) |
| 51 | | render_highlighted("puts 'foo'", "foo.rb") |
| 50 | helper.should_receive(:line_numbers_for).and_return(123) |
| 51 | helper.render_highlighted("puts 'foo'", "foo.rb") |
| 52 | 52 | end |
| 53 | 53 | end |
| 54 | 54 | |
| 55 | 55 | describe "too_big_to_render" do |
| 56 | 56 | it "knows when a blob is too big to be rendered within reasonable time" do |
| 57 | | too_big_to_render?(1.kilobyte).should == false |
| 58 | | too_big_to_render?(150.kilobyte+1).should == true |
| 57 | helper.too_big_to_render?(1.kilobyte).should == false |
| 58 | helper.too_big_to_render?(150.kilobyte+1).should == true |
| 59 | 59 | end |
| 60 | 60 | end |
| 61 | 61 | |
| toggle raw diff |
--- a/spec/helpers/blobs_helper_spec.rb
+++ b/spec/helpers/blobs_helper_spec.rb
@@ -2,30 +2,34 @@ require File.dirname(__FILE__) + '/../spec_helper'
describe BlobsHelper do
+ def included_modules
+ (class << helper; self; end).send(:included_modules)
+ end
+
it "includes the RepostoriesHelper" do
- self.class.ancestors.should include(RepositoriesHelper)
+ included_modules.should include(RepositoriesHelper)
end
it "includes the TreesHelper" do
- self.class.ancestors.should include(TreesHelper)
- end
+ included_modules.should include(TreesHelper)
+ end
describe "line_numbers_for" do
it "renders something with line numbers" do
- numbered = line_numbers_for("foo\nbar\nbaz")
+ numbered = helper.line_numbers_for("foo\nbar\nbaz")
numbered.should include(%Q{<td class="line-numbers"><a href="#line2" name="line2">2</a></td>})
numbered.should include(%Q{<td class="code">bar</td>})
end
it "renders one line with line numbers" do
- numbered = line_numbers_for("foo")
+ numbered = helper.line_numbers_for("foo")
numbered.should include(%Q{<td class="line-numbers"><a href="#line1" name="line1">1</a></td>})
numbered.should include(%Q{<td class="code">foo</td>})
end
it "doesn't blow up when with_line_numbers receives nil" do
proc{
- line_numbers_for(nil).should == %Q{<table id="codeblob" class="highlighted">\n</table>}
+ helper.line_numbers_for(nil).should == %Q{<table id="codeblob" class="highlighted">\n</table>}
}.should_not raise_error
end
end
@@ -33,25 +37,25 @@ describe BlobsHelper do
describe "render_highlighted()" do
it "tries to figure out the filetype" do
Uv.should_receive(:syntax_names_for_data).with("foo.rb", "puts 'foo'").and_return(["ruby"])
- render_highlighted("puts 'foo'", "foo.rb")
+ helper.render_highlighted("puts 'foo'", "foo.rb")
end
it "parses the text" do
Uv.should_receive(:syntax_names_for_data).with("foo.rb", "puts 'foo'").and_return(["ruby"])
Uv.should_receive(:parse).and_return("puts 'foo'")
- render_highlighted("puts 'foo'", "foo.rb")
+ helper.render_highlighted("puts 'foo'", "foo.rb")
end
it "adds linenumbers" do
- should_receive(:line_numbers_for).and_return(123)
- render_highlighted("puts 'foo'", "foo.rb")
+ helper.should_receive(:line_numbers_for).and_return(123)
+ helper.render_highlighted("puts 'foo'", "foo.rb")
end
end
describe "too_big_to_render" do
it "knows when a blob is too big to be rendered within reasonable time" do
- too_big_to_render?(1.kilobyte).should == false
- too_big_to_render?(150.kilobyte+1).should == true
+ helper.too_big_to_render?(1.kilobyte).should == false
+ helper.too_big_to_render?(150.kilobyte+1).should == true
end
end
|
| |   |
| 3 | 3 | describe CommitsHelper do |
| 4 | 4 | |
| 5 | 5 | it "includes the RepostoriesHelper" do |
| 6 | | self.class.ancestors.should include(RepositoriesHelper) |
| 6 | included_modules = (class << helper; self; end).send(:included_modules) |
| 7 | included_modules.should include(RepositoriesHelper) |
| 7 | 8 | end |
| 8 | 9 | |
| 9 | 10 | describe "render_diff_stats" do |
| … | … | |
| 23 | 23 | |
| 24 | 24 | it "renders a list of files as anchor links" do |
| 25 | 25 | files = @stats.files.keys |
| 26 | | rendered_stats = render_diff_stats(@stats) |
| 26 | rendered_stats = helper.render_diff_stats(@stats) |
| 27 | 27 | files.each do |filename| |
| 28 | 28 | rendered_stats.should include(%Q{<li><a href="##{h(filename)}">#{h(filename)}</a>}) |
| 29 | 29 | end |
| 30 | 30 | end |
| 31 | 31 | |
| 32 | 32 | it "renders a graph of minuses for deletions" do |
| 33 | | render_diff_stats(@stats).should include(%Q{spec/database_spec.rb</a> 17 <small class="deletions">#{"-"*12}</small>}) |
| 33 | helper.render_diff_stats(@stats).should include(%Q{spec/database_spec.rb</a> 17 <small class="deletions">#{"-"*12}</small>}) |
| 34 | 34 | end |
| 35 | 35 | |
| 36 | 36 | it "renders a graph of plusses for inserts" do |
| 37 | | render_diff_stats(@stats).should match( |
| 37 | helper.render_diff_stats(@stats).should match( |
| 38 | 38 | /spec\/database_spec\.rb<\/a> 17 <small class="deletions.+<\/small><small class="insertions">#{"\\+"*5}<\/small>/ |
| 39 | 39 | ) |
| 40 | 40 | end |
| toggle raw diff |
--- a/spec/helpers/commits_helper_spec.rb
+++ b/spec/helpers/commits_helper_spec.rb
@@ -3,7 +3,8 @@ require File.dirname(__FILE__) + '/../spec_helper'
describe CommitsHelper do
it "includes the RepostoriesHelper" do
- self.class.ancestors.should include(RepositoriesHelper)
+ included_modules = (class << helper; self; end).send(:included_modules)
+ included_modules.should include(RepositoriesHelper)
end
describe "render_diff_stats" do
@@ -22,18 +23,18 @@ describe CommitsHelper do
it "renders a list of files as anchor links" do
files = @stats.files.keys
- rendered_stats = render_diff_stats(@stats)
+ rendered_stats = helper.render_diff_stats(@stats)
files.each do |filename|
rendered_stats.should include(%Q{<li><a href="##{h(filename)}">#{h(filename)}</a>})
end
end
it "renders a graph of minuses for deletions" do
- render_diff_stats(@stats).should include(%Q{spec/database_spec.rb</a> 17 <small class="deletions">#{"-"*12}</small>})
+ helper.render_diff_stats(@stats).should include(%Q{spec/database_spec.rb</a> 17 <small class="deletions">#{"-"*12}</small>})
end
it "renders a graph of plusses for inserts" do
- render_diff_stats(@stats).should match(
+ helper.render_diff_stats(@stats).should match(
/spec\/database_spec\.rb<\/a> 17 <small class="deletions.+<\/small><small class="insertions">#{"\\+"*5}<\/small>/
)
end |
| |   |
| 11 | 11 | Need to investigate if this is a Rails bug and |
| 12 | 12 | either fix it there or let go of obfuscation. |
| 13 | 13 | } |
| 14 | | #pending(message) do |
| 14 | pending(message) do |
| 15 | 15 | email = "aAT@NOSPAM@bDOTcom" |
| 16 | 16 | encoded = (0...email.length).inject("") do |result, index| |
| 17 | 17 | result << sprintf("%%%x",email[index]) |
| 18 | 18 | end |
| 19 | 19 | helper.encoded_mail_to("a@b.com").should match(/#{encoded}/) |
| 20 | | #end |
| 20 | end |
| 21 | 21 | end |
| 22 | 22 | end |
| toggle raw diff |
--- a/spec/helpers/users_helper_spec.rb
+++ b/spec/helpers/users_helper_spec.rb
@@ -11,12 +11,12 @@ describe UsersHelper do
Need to investigate if this is a Rails bug and
either fix it there or let go of obfuscation.
}
- #pending(message) do
+ pending(message) do
email = "aAT@NOSPAM@bDOTcom"
encoded = (0...email.length).inject("") do |result, index|
result << sprintf("%%%x",email[index])
end
helper.encoded_mail_to("a@b.com").should match(/#{encoded}/)
- #end
+ end
end
end |