Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please teach me how to monitoring unit test #49

Open
onigra opened this issue Oct 16, 2014 · 0 comments
Open

Please teach me how to monitoring unit test #49

onigra opened this issue Oct 16, 2014 · 0 comments

Comments

@onigra
Copy link

onigra commented Oct 16, 2014

Sorry, my english is terrible.

I want to monitoring test in rspec.
i tried below, but "create!" doesn't puts stdout.
Please teach me something wrong point.

Thanks.

https://github.com/onigra/fssm_test

# test.rb

require 'fssm'

module Foo
  def self.run
    FSSM.monitor(File.expand_path("./lib/tmp"), "**/*") do
      create { |monitoring_dir, new_file| puts "create!" }
    end
  end
end

# Foo.run
# test_spec.rb

require 'spec_helper'

describe Foo do
  before :all do
    @path = File.expand_path("./lib/tmp")
    @pid = fork { Foo.run }
  end

  after :all do
    Process.kill "KILL", @pid
    File.delete "#{@path}/file"
  end

  describe ".run" do
    it "puts create!" do
      FileUtils.touch "#{@path}/file"
    end
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant