Skip to content

Commit

Permalink
Use Specinfra::Runner instance instead of calling backend directly
Browse files Browse the repository at this point in the history
  • Loading branch information
mizzy committed Aug 1, 2014
1 parent b701a62 commit 300dfb1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
12 changes: 9 additions & 3 deletions lib/serverspec/type/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def mounted?(attr, only_with)
end

def immutable?
backend.check_file_is_immutable(@name)
@runner.check_file_is_immutable(@name)
end

def match_checksum(checksum)
Expand All @@ -101,13 +101,19 @@ def version?(version)
end

def mtime
d = backend.get_file_mtime(@name).stdout.strip
d = @runner.get_file_mtime(@name).stdout.strip
DateTime.strptime(d, '%s').new_offset(DateTime.now.offset)
end

def size
backend.get_file_size(@name).stdout.strip.to_i
@runner.get_file_size(@name).stdout.strip.to_i
end
end
end
end






4 changes: 2 additions & 2 deletions lib/serverspec/type/ppa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ module Serverspec
module Type
class Ppa < Base
def exists?
backend.check_ppa_exists(@name)
@runner.check_ppa_exists(@name)
end

def enabled?
backend.check_ppa_is_enabled(@name)
@runner.check_ppa_is_enabled(@name)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/serverspec/type/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def belongs_to_group?(group)
end

def belongs_to_primary_group?(group)
backend.check_user_belongs_to_primary_group(@name, group)
@runner.check_user_belongs_to_primary_group(@name, group)
end

def has_uid?(uid)
Expand Down

0 comments on commit 300dfb1

Please sign in to comment.