Commit 5b6844692e9d34478e00a9e7800a594e6050afc4

Updated some of the helper specs to the new-style

Commit diff

config/environments/development.rb

 
1111# Show full error reports and disable caching
1212config.action_controller.consider_all_requests_local = true
1313config.action_controller.perform_caching = false
14config.action_view.cache_template_extensions = false
1514config.action_view.debug_rjs = true
1615
1716# ActionMailer::Base.default_url_options[:protocol] = 'https'
toggle raw diff

config/environments/production.rb

 
1414# Full error reports are disabled and caching is turned on
1515config.action_controller.consider_all_requests_local = false
1616config.action_controller.perform_caching = true
17config.action_view.cache_template_extensions = true
1817
1918cache_dir = File.expand_path(File.join(RAILS_ROOT, 'public', 'cache'))
2019config.action_controller.page_cache_directory = cache_dir
toggle raw diff

spec/helpers/application_helper_spec.rb

 
44
55 it "renders a message if an object is not ready?" do
66 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")
88 end
99
1010 it "renders block if object is ready" do
1111 obj = mock("any given object")
1212 obj.stub!(:ready?).and_return(true)
13 render_if_ready(obj) do
13 helper.render_if_ready(obj) do
1414 "moo"
1515 end.should == "moo"
1616 end
1919 obj = mock("any given object")
2020 obj.stub!(:ready?).and_return(false)
2121 _erbout = "" # damn you RSpec!
22 render_if_ready(obj) do
22 helper.render_if_ready(obj) do
2323 "moo"
2424 end
2525 _erbout.should_not == "moo"
2727 end
2828
2929 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"
3535 end
3636
3737 it "generates a valid gravatar url" do
3838 email = "someone@myemail.com";
3939 url = gravatar_url_for(email)
4040
41 base_url(url).should == "www.gravatar.com"
41 helper.base_url(url).should == "www.gravatar.com"
4242 url.include?(Digest::MD5.hexdigest(email)).should == true
4343 url.include?("avatar.php?").should == true
4444 end
4646
4747 it "should generate a blank commit graph url if the graph isn't there" do
4848 File.should_receive(:exist?).and_return(false)
49 url = commit_graph_tag(repositories(:johans))
49 url = helper.commit_graph_tag(repositories(:johans))
5050 url.should == nil
5151 end
5252
5353 it "should generate a blank url for commit graph by author if the graph isn't there" do
5454 File.should_receive(:exist?).and_return(false)
5555
56 url = commit_graph_by_author_tag(repositories(:johans))
56 url = helper.commit_graph_by_author_tag(repositories(:johans))
5757 url.should == nil
5858 end
5959end
toggle raw diff

spec/helpers/blobs_helper_spec.rb

 
22
33describe BlobsHelper do
44
5 def included_modules
6 (class << helper; self; end).send(:included_modules)
7 end
8
59 it "includes the RepostoriesHelper" do
6 self.class.ancestors.should include(RepositoriesHelper)
10 included_modules.should include(RepositoriesHelper)
711 end
812
913 it "includes the TreesHelper" do
10 self.class.ancestors.should include(TreesHelper)
11 end
14 included_modules.should include(TreesHelper)
15 end
1216
1317 describe "line_numbers_for" do
1418 it "renders something with line numbers" do
15 numbered = line_numbers_for("foo\nbar\nbaz")
19 numbered = helper.line_numbers_for("foo\nbar\nbaz")
1620 numbered.should include(%Q{<td class="line-numbers"><a href="#line2" name="line2">2</a></td>})
1721 numbered.should include(%Q{<td class="code">bar</td>})
1822 end
1923
2024 it "renders one line with line numbers" do
21 numbered = line_numbers_for("foo")
25 numbered = helper.line_numbers_for("foo")
2226 numbered.should include(%Q{<td class="line-numbers"><a href="#line1" name="line1">1</a></td>})
2327 numbered.should include(%Q{<td class="code">foo</td>})
2428 end
2529
2630 it "doesn't blow up when with_line_numbers receives nil" do
2731 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>}
2933 }.should_not raise_error
3034 end
3135 end
3737 describe "render_highlighted()" do
3838 it "tries to figure out the filetype" do
3939 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")
4141 end
4242
4343 it "parses the text" do
4444 Uv.should_receive(:syntax_names_for_data).with("foo.rb", "puts 'foo'").and_return(["ruby"])
4545 Uv.should_receive(:parse).and_return("puts 'foo'")
46 render_highlighted("puts 'foo'", "foo.rb")
46 helper.render_highlighted("puts 'foo'", "foo.rb")
4747 end
4848
4949 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")
5252 end
5353 end
5454
5555 describe "too_big_to_render" do
5656 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
5959 end
6060 end
6161
toggle raw diff

spec/helpers/commits_helper_spec.rb

 
33describe CommitsHelper do
44
55 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)
78 end
89
910 describe "render_diff_stats" do
2323
2424 it "renders a list of files as anchor links" do
2525 files = @stats.files.keys
26 rendered_stats = render_diff_stats(@stats)
26 rendered_stats = helper.render_diff_stats(@stats)
2727 files.each do |filename|
2828 rendered_stats.should include(%Q{<li><a href="##{h(filename)}">#{h(filename)}</a>})
2929 end
3030 end
3131
3232 it "renders a graph of minuses for deletions" do
33 render_diff_stats(@stats).should include(%Q{spec/database_spec.rb</a>&nbsp;17&nbsp;<small class="deletions">#{"-"*12}</small>})
33 helper.render_diff_stats(@stats).should include(%Q{spec/database_spec.rb</a>&nbsp;17&nbsp;<small class="deletions">#{"-"*12}</small>})
3434 end
3535
3636 it "renders a graph of plusses for inserts" do
37 render_diff_stats(@stats).should match(
37 helper.render_diff_stats(@stats).should match(
3838 /spec\/database_spec\.rb<\/a>&nbsp;17&nbsp;<small class="deletions.+<\/small><small class="insertions">#{"\\+"*5}<\/small>/
3939 )
4040 end
toggle raw diff

spec/helpers/logs_helper_spec.rb

 
33describe LogsHelper do
44
55 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)
78 end
89end
toggle raw diff

spec/helpers/trees_helper_spec.rb

 
33describe TreesHelper do
44
55 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)
78 end
89
910 describe "commit_for_tree_path" do
toggle raw diff

spec/helpers/users_helper_spec.rb

 
1111 Need to investigate if this is a Rails bug and
1212 either fix it there or let go of obfuscation.
1313 }
14 #pending(message) do
14 pending(message) do
1515 email = "aAT@NOSPAM@bDOTcom"
1616 encoded = (0...email.length).inject("") do |result, index|
1717 result << sprintf("%%%x",email[index])
1818 end
1919 helper.encoded_mail_to("a@b.com").should match(/#{encoded}/)
20 #end
20 end
2121 end
2222end
toggle raw diff

vendor/plugins/rspec-rails/lib/spec/rails/example/rails_example_group.rb

 
11require 'spec/interop/test'
22
3ActionView::Base.cache_template_extensions = false
4
53module Spec
64 module Rails
75
toggle raw diff