Skip to content

Commit

Permalink
add specs for user and group settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Rogers committed Apr 18, 2012
1 parent d9970fb commit 3421f2d
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions spec/fpm/package/rpm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,48 @@
end
end

describe "#templating" do
context "default user and group" do
before :all do

# set the list of files for this RPM
def subject.files; [__FILE__]; end
def subject.rpmspec; @rpmspec; end
def subject.render_template; @rpmspec = template("rpm.erb").result(binding); end
subject.render_template
end

after :all do
subject.cleanup
end

it "should set the user and group of each file in the RPM" do
subject.rpmspec.should include('%defattr(-,root,root,-')
end
end # context

context "non-default user and group" do
before :all do
subject.attributes[:rpm_user] = "some_user"
subject.attributes[:rpm_group] = "some_group"

# set the list of files for this RPM
def subject.files; [__FILE__]; end
def subject.rpmspec; @rpmspec; end
def subject.render_template; @rpmspec = template("rpm.erb").result(binding); end
subject.render_template
end

after :all do
subject.cleanup
end

it "should set the user and group of each file in the RPM" do
subject.rpmspec.should include('%defattr(-,some_user,some_group,-')
end
end # context
end

describe "#output", :if => program_in_path?("rpmbuild") do
context "package attributes" do
before :all do
Expand Down

0 comments on commit 3421f2d

Please sign in to comment.