Skip to content

Instantly share code, notes, and snippets.

@alindeman
Created December 6, 2011 20:44
Show Gist options
  • Select an option

  • Save alindeman/1439921 to your computer and use it in GitHub Desktop.

Select an option

Save alindeman/1439921 to your computer and use it in GitHub Desktop.
describe "#users", fakefs: true do
def stub_etc_passwd
FileUtils.mkdir("/etc")
File.open("/etc/passwd", "w") do |f|
f.puts("andy:*:100:100")
f.puts("bob:*:101:102")
end
end
it "reads /etc/passwd and returns user information" do
stub_etc_passwd
users.should == [["andy", "*", "100", "100"],
["bob", "*", "101", "101"]]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment