Browse files

reinstate some drb specs (almost home)

  • Loading branch information...
1 parent b67cebc commit cca4f0e9fa9e6ac880ec7c05f14d5f9d5846f000 @dchelimsky dchelimsky committed Jun 2, 2010
Showing with 73 additions and 73 deletions.
  1. +73 −73 spec/rspec/core/drb_command_line_spec.rb
View
146 spec/rspec/core/drb_command_line_spec.rb
@@ -69,83 +69,83 @@ def with_RSPEC_DRB_set_to(val)
end
end
end
-
end
- # context "with server running" do
- # class ::FakeDrbSpecServer
- # def self.run(argv, err, out)
- # RSpec::Core::CommandLine.new(argv).run(err, out)
- # end
- # end
-
- # def dummy_spec_filename
- # @dummy_spec_filename ||= File.expand_path(File.dirname(__FILE__)) + "/_dummy_spec#{@drb_example_file_counter}.rb"
- # end
+
+ context "with server running" do
+ class ::FakeDrbSpecServer
+ def self.run(argv, err, out)
+ RSpec::Core::CommandLine.new(argv).run(err, out)
+ end
+ end
+
+ def dummy_spec_filename
+ @dummy_spec_filename ||= File.expand_path(File.dirname(__FILE__)) + "/_dummy_spec#{@drb_example_file_counter}.rb"
+ end
- # before(:all) do
- # @drb_port = 8990
- # @drb_example_file_counter = 0
- # DRb::start_service("druby://127.0.0.1:#{@drb_port}", ::FakeDrbSpecServer)
- # end
-
- # before(:each) do
- # @drb_example_file_counter += 1
- # create_dummy_spec_file
- # end
-
- # after(:each) do
- # File.delete(dummy_spec_filename)
- # end
-
- # after(:all) do
- # DRb::stop_service
- # end
-
- # def create_dummy_spec_file
- # File.open(dummy_spec_filename, 'w') do |f|
- # f.write %q{
- # p __FILE__
- # describe "DUMMY CONTEXT for 'DrbCommandLine with -c option'" do
- # it "should be output with green bar" do
- # true.should be_true
- # end
-
- # it "should be output with red bar" do
- # raise("I want to see a red bar!")
- # end
- # end
- # }
- # end
- # end
-
- # def run_spec_via_druby(argv)
- # err, out = StringIO.new, StringIO.new
- # RSpec::Core::DRbCommandLine.new(argv.push("--drb-port", @drb_port.to_s)).run(err, out)
- # out.rewind
- # out.read
- # end
-
- # it "returns true" do
- # err, out = StringIO.new, StringIO.new
- # result = RSpec::Core::DRbCommandLine.new(["--drb-port", @drb_port.to_s]).run(err, out)
- # result.should be_true
- # end
+ before(:all) do
+ @drb_port = 8990
+ @drb_example_file_counter = 0
+ DRb::start_service("druby://127.0.0.1:#{@drb_port}", ::FakeDrbSpecServer)
+ end
+
+ before(:each) do
+ @drb_example_file_counter += 1
+ create_dummy_spec_file
+ end
+
+ after(:each) do
+ File.delete(dummy_spec_filename)
+ end
+
+ after(:all) do
+ DRb::stop_service
+ end
+
+ def create_dummy_spec_file
+ File.open(dummy_spec_filename, 'w') do |f|
+ f.write %q{
+ describe "DUMMY CONTEXT for 'DrbCommandLine with -c option'" do
+ it "should be output with green bar" do
+ true.should be_true
+ end
+
+ it "should be output with red bar" do
+ raise("I want to see a red bar!")
+ end
+ end
+ }
+ end
+ end
+
+ def run_spec_via_druby(argv)
+ err, out = StringIO.new, StringIO.new
+ RSpec::Core::DRbCommandLine.new(argv.push("--drb-port", @drb_port.to_s)).run(err, out)
+ out.rewind
+ out.read
+ end
+
+ it "returns true" do
+ err, out = StringIO.new, StringIO.new
+ result = RSpec::Core::DRbCommandLine.new(["--drb-port", @drb_port.to_s]).run(err, out)
+ result.should be_true
+ end
- # it "should output green colorized text when running with --colour option" do
- # out = run_spec_via_druby(["--colour", dummy_spec_filename])
- # out.should =~ /\e\[32m/m
- # end
+ it "should output green colorized text when running with --colour option" do
+ out = run_spec_via_druby(["--colour", dummy_spec_filename])
+ out.should =~ /\e\[32m/m
+ end
- # it "should output red colorized text when running with -c option" do
- # out = run_spec_via_druby(["-c", dummy_spec_filename])
- # out.should =~ /\e\[31m/m
- # end
+ it "should output red colorized text when running with -c option" do
+ pending
+ out = run_spec_via_druby(["-c", dummy_spec_filename])
+ out.should =~ /\e\[31m/m
+ end
- # it "integrates via Runner.new.run" do
- # err, out = StringIO.new, StringIO.new
- # result = RSpec::Core::Runner.new.run(%W[ --drb --drb-port #{@drb_port} #{dummy_spec_filename}], err, out)
- # result.should be_true
- # end
- # end
+ it "integrates via Runner.new.run" do
+ err, out = StringIO.new, StringIO.new
+ result = RSpec::Core::Runner.run(%W[ --drb --drb-port #{@drb_port} #{dummy_spec_filename}], err, out)
+ result.should be_true
+ end
+ end
end

0 comments on commit cca4f0e

Please sign in to comment.