Skip to content

Instantly share code, notes, and snippets.

@ukstudio
Created February 27, 2012 09:59
Show Gist options
  • Save ukstudio/1922869 to your computer and use it in GitHub Desktop.
Save ukstudio/1922869 to your computer and use it in GitHub Desktop.
rspec
describe Fixnum do
subject { [1,2,3,4] }
specify { subject.all?{|v| v==1} }
it { should_not be_all{|v| v==1 }}
it { should be_any{|v| v==1 } }
it { should be_any(&lambda{|v| v==1 }) }
end
class Foo
def active?
true
end
end
class Bar
def active?
false
end
end
describe Foo do
subject { [Foo.new,Bar.new] }
it { should be_any(&:active?) }
it { should_not be_all(&:active?) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment