Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/separate-ap'
- Loading branch information
Showing
15 changed files
with
101 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
require 'tapp/printer' | ||
require 'pp' | ||
|
||
module Tapp::Printer | ||
class PrettyPrint < Base | ||
def print(*args) | ||
pp *args | ||
require 'pp' | ||
|
||
self.class.class_eval do | ||
remove_method :print | ||
|
||
def print(*args) | ||
pp *args | ||
end | ||
end | ||
|
||
print *args | ||
end | ||
end | ||
|
||
register :pretty_print, PrettyPrint | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,6 @@ def print(*args) | |
puts *args | ||
end | ||
end | ||
|
||
register :puts, Puts | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module Tapp | ||
module Turnip | ||
module Steps | ||
step 'I have the following code:' do |code| | ||
@code = code | ||
end | ||
|
||
step 'a file named :filename with:' do |filename, code| | ||
@filename, @code = filename, code | ||
end | ||
|
||
step 'Ruby it' do | ||
stdout = StringIO.new | ||
$stdout = stdout | ||
|
||
begin | ||
if @filename | ||
eval @code, binding, @filename, 1 | ||
else | ||
eval @code | ||
end | ||
ensure | ||
$stdout = STDOUT | ||
end | ||
|
||
@output = stdout.string.gsub(/\e\[0.*?m/, '').chop | ||
end | ||
|
||
step 'I should see:' do |output| | ||
@output.should == output | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Tapp | ||
VERSION = '1.4.1' | ||
VERSION = '1.5.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Feature: Custom printer | ||
Scenario: define a custom printer and use it | ||
Given I have the following code: | ||
""" | ||
require 'tapp/printer' | ||
module Tapp::Printer | ||
class MyPrinter < Base | ||
def print(*args) | ||
puts "*** #{args.join(' ')} ***" | ||
end | ||
end | ||
register :my_printer, MyPrinter | ||
end | ||
%w(foo bar).tapp(:my_printer) | ||
""" | ||
|
||
When Ruby it | ||
Then I should see: | ||
""" | ||
*** foo bar *** | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
Feature: config.default_printer | ||
Scenario: set config.default_printer to :awesome_print and call tapp | ||
Scenario: set config.default_printer to :puts and call tapp | ||
Given I have the following code: | ||
""" | ||
Tapp.config.default_printer = :awesome_print | ||
Tapp.config.default_printer = :puts | ||
'hoge'.tapp | ||
""" | ||
|
||
When Ruby it | ||
Then I should see: | ||
""" | ||
"hoge" | ||
hoge | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters