Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

some (spec/desc) tweaks

  • Loading branch information...
commit b59cb2cf595ead0fbccfe4b2735858725badcab5 1 parent f90ba23
@janlelis authored
View
2  desc/ivars.yaml
@@ -1,7 +1,7 @@
ivars:
summary: This method lets you easily assign lots of instance variables.
why: |
- Often, you have to write boilerplate code for assigning instance varialbles, for example this one:
+ Often, you have to write boilerplate code for assigning instance variables, for example this one:
⇧def initialize(variable1, variable2)
  @variable1, @variable2 = variable1, variable2
end⇧
View
2  desc/os.yaml
@@ -9,7 +9,7 @@ os:
OS.windows?: "include OS; windows? # true for windows. Example of including OS to get the os methods into the global namespace"
OS.solaris?: "OS.solaris? # true for solaris/sunos"
OS.posix?: "OS.posix? # true if system is posix compatible"
- OS.is?: "OS.is? /win/ # matches the regex against the os string"
+ OS.is?: "OS.is? /x/ # matches the regex against the os string"
info:
- This cube depends on system information and may not be 100% accurate.
- "Syntax and semantic inspired by Roger Pack's →os gem→http://github.com/rdp/os→."
View
6 lib/zucker/kernel.rb
@@ -21,13 +21,15 @@ def executed_directly?
$PROGRAM_NAME == $` # __FILE__
end
alias standalone? executed_directly?
+ alias directly_executed? executed_directly?
def irb?
- !!(( IRB and $0 == 'irb' ) rescue nil)
+ (defined?(IRB) && $0 =~ /irb/) || (defined?(Ripl) && $0 =~ /ripl/)
end
def ignore_sigint! # ctrl+c
- Signal.trap *%w|SIGINT IGNORE|
+ Signal.trap *%w|SIGINT IGNORE|
+ true
end
end
View
6 spec/egonil_spec.rb
@@ -22,5 +22,11 @@
egonil{ 5.a_method }
end.should raise_exception NoMethodError
end
+
+ it 'should raise other Exceptions' do
+ proc do
+ egonil{ 5 / 0 }
+ end.should raise_exception ZeroDivisionError
+ end
end
View
9 spec/iterate_spec.rb
@@ -25,7 +25,6 @@
iterate a, b do |e,f|
res[:iter_a_b] << [e, f]
-# p res[:iter_a_b], e, f
end
res[:iter_a_b].should == [
@@ -49,6 +48,12 @@
end
it 'should return enumerators if no block is applied' do
+ res = Hash.new {[]} # TODO: why?
+ res[:iter_a_b] = [] # ....
+ res[:iter_b_a] = [] # ....
+
+ enumerator = iterate a,b
+ enumerator.should be_kind_of(RUBY_VERSION < '1.9' ? Enumerable::Enumerator : Enumerator)
+ enumerator.to_a.should == [[1,'a'], [2,'b'], [3,'c'], [nil, 'd']]
end
end
-
View
5 spec/tap_19spec.rb
@@ -11,9 +11,8 @@
describe 'make_new' do
it 'should create a new instance of the class given as argument, apply the block on it and return result' do
- res = make_new Hash do |obj|
+ make_new Hash do |obj|
obj[1] = 2
- end
- res.should == { 1=>2 }
+ end.should == { 1=>2 }
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.