Skip to content
This repository has been archived by the owner on Jun 23, 2020. It is now read-only.

Commit

Permalink
Add Gem#file_name helper
Browse files Browse the repository at this point in the history
  • Loading branch information
movitto committed Jun 3, 2014
1 parent 8d9b6d7 commit f59fd99
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/polisher/gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class Gem

attr_accessor :path

def file_name
"#{name}-#{version}.gem"
end

def initialize(args = {})
@spec = args[:spec]
@name = args[:name]
Expand Down
8 changes: 8 additions & 0 deletions spec/gem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@

module Polisher
describe Gem do
describe "#file_name" do
it "returns name-version.gem" do
expected = 'rails-4.0.0.gem'
Polisher::Gem.new(:name => 'rails', :version => '4.0.0')
.file_name.should == expected
end
end

describe "#initialize" do
it "sets gem attributes" do
gem = described_class.new :name => 'rails',
Expand Down

0 comments on commit f59fd99

Please sign in to comment.