Skip to content

Commit

Permalink
Instead of using template.html.erb use index.erb, simpler and better
Browse files Browse the repository at this point in the history
  • Loading branch information
alloy committed Mar 5, 2009
1 parent e2b30a0 commit 5a335fb
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Rakefile
Expand Up @@ -57,5 +57,9 @@ task :generate_repo_fixture_archive do
archive = "#{repo}.tgz"

rm_rf File.join(fixtures, archive)

sh "cd '#{File.join(fixtures, repo)}' && git add . && git commit -a -m 'Regenerating repo fixture'"
sh "cd '#{fixtures}' && tar czf #{archive} #{repo}"

rm_rf 'test/tmp'
end
2 changes: 1 addition & 1 deletion lib/jewelry_portfolio.rb
Expand Up @@ -19,7 +19,7 @@ def initialize(account, repo = nil)
@repo = repo
@index = ReposIndex.new(@account, (Dir.pwd unless @repo))

@html_template = template(Template::HTML, 'template.html.erb')
@html_template = template(Template::HTML, 'index.erb')
@feed_template = template(Template::Feed, 'feed.rb')

@index.add(@repo) if @repo
Expand Down
Binary file modified test/fixtures/alloy.github.com.tgz
Binary file not shown.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions test/jewelry_portfolio_test.rb
Expand Up @@ -45,7 +45,7 @@
it "should return the html template" do
template = @portfolio.html_template
template.should.be.instance_of JewelryPortfolio::Template::HTML
template.file.should == File.join(@portfolio.index.path, 'template.html.erb')
template.file.should == File.join(@portfolio.index.path, 'index.erb')
template.account.should == 'alloy'
template.repos.should == @portfolio.index.repos.to_a.sort_by { |r| r.name }
end
Expand All @@ -64,7 +64,7 @@
expected_feed = File.read(fixture('feed_with_options.xml')).gsub('TIME_NOW', time.iso8601)

@portfolio.render!
File.read(File.join(@portfolio.index.path, 'index.html')).should == File.read(fixture('template.html'))
File.read(File.join(@portfolio.index.path, 'index.html')).should == File.read(fixture('index.html'))
File.read(File.join(@portfolio.index.path, 'feed.xml')).should == expected_feed
end

Expand Down
4 changes: 2 additions & 2 deletions test/template_test.rb
Expand Up @@ -34,7 +34,7 @@ def self.included(klass)
@repos = %w{ dr-nic-magic-awesome.gemspec_ microgem.gemspec_ }.
map { |spec| JewelryPortfolio::Repo.new('alloy', fixture_eval(spec)) }

@file = fixture('template.html.erb')
@file = fixture('index.erb')
@template = JewelryPortfolio::Template::HTML.new(@file, 'alloy', @repos.to_set)
end

Expand All @@ -46,7 +46,7 @@ def self.included(klass)
end

it "should render the ERB template" do
@template.render.should == File.read(fixture('template.html'))
@template.render.should == File.read(fixture('index.html'))
end

it "should return the repos ordered by name" do
Expand Down

0 comments on commit 5a335fb

Please sign in to comment.