Permalink
Browse files

Added specs for Yellow, Blue, and Magenta. Changed specs for Red and …

…Green
  • Loading branch information...
1 parent bfd5037 commit 5f7c488cf532c2a406a26818e0e7c1cddfc092c1 @hotgazpacho committed Jun 24, 2009
Showing with 36 additions and 6 deletions.
  1. +8 −2 lib/iron-term-ansicolor.rb
  2. +28 −4 spec/iron-term-ansicolor_spec.rb
View
@@ -19,9 +19,15 @@ def puts(*args)
when 30
System::Console.ForegroundColor = System::ConsoleColor.Black
when 31
- System::Console.ForegroundColor = System::ConsoleColor.Red
+ System::Console.ForegroundColor = System::ConsoleColor.DarkRed
when 32
- System::Console.ForegroundColor = System::ConsoleColor.Green
+ System::Console.ForegroundColor = System::ConsoleColor.DarkGreen
+ when 33
+ System::Console.ForegroundColor = System::ConsoleColor.DarkYellow
+ when 34
+ System::Console.ForegroundColor = System::ConsoleColor.DarkBlue
+ when 35
+ System::Console.ForegroundColor = System::ConsoleColor.DarkMagenta
end
original_puts(matches[2])
System::Console.ForegroundColor = originalColor
@@ -14,18 +14,42 @@
puts string
end
- it "should set the foreground color to red when doing a puts of a string with only red ANSI control code and reset the foreground color after" do
+ it "should set the foreground color to dark red when doing a puts of a string with only red ANSI control code and reset the foreground color after" do
string = "Red".red
System::Console.should_receive(:ForegroundColor).once.and_return(@original_color)
- System::Console.should_receive(:ForegroundColor=).ordered.with(System::ConsoleColor.Red)
+ System::Console.should_receive(:ForegroundColor=).ordered.with(System::ConsoleColor.DarkRed)
System::Console.should_receive(:ForegroundColor=).ordered.with(@original_color)
puts string
end
- it "should set the foreground color to green when doing a puts of a string with only green ANSI control code and reset the foreground color after" do
+ it "should set the foreground color to dark green when doing a puts of a string with only green ANSI control code and reset the foreground color after" do
string = "Green".green
System::Console.should_receive(:ForegroundColor).once.and_return(@original_color)
- System::Console.should_receive(:ForegroundColor=).ordered.with(System::ConsoleColor.Green)
+ System::Console.should_receive(:ForegroundColor=).ordered.with(System::ConsoleColor.DarkGreen)
+ System::Console.should_receive(:ForegroundColor=).ordered.with(@original_color)
+ puts string
+ end
+
+ it "should set the foreground color to dark yellow when doing a puts of a string with only yellow ANSI control code and reset the foreground color after" do
+ string = "Yellow".yellow
+ System::Console.should_receive(:ForegroundColor).once.and_return(@original_color)
+ System::Console.should_receive(:ForegroundColor=).ordered.with(System::ConsoleColor.DarkYellow)
+ System::Console.should_receive(:ForegroundColor=).ordered.with(@original_color)
+ puts string
+ end
+
+ it "should set the foreground color to dark blue when doing a puts of a string with only blue ANSI control code and reset the foreground color after" do
+ string = "Blue".blue
+ System::Console.should_receive(:ForegroundColor).once.and_return(@original_color)
+ System::Console.should_receive(:ForegroundColor=).ordered.with(System::ConsoleColor.DarkBlue)
+ System::Console.should_receive(:ForegroundColor=).ordered.with(@original_color)
+ puts string
+ end
+
+ it "should set the foreground color to dark magenta when doing a puts of a string with only magenta ANSI control code and reset the foreground color after" do
+ string = "Magenta".magenta
+ System::Console.should_receive(:ForegroundColor).once.and_return(@original_color)
+ System::Console.should_receive(:ForegroundColor=).ordered.with(System::ConsoleColor.DarkMagenta)
System::Console.should_receive(:ForegroundColor=).ordered.with(@original_color)
puts string
end

0 comments on commit 5f7c488

Please sign in to comment.