Skip to content

Instantly share code, notes, and snippets.

@guenin
Created February 17, 2012 19:46
Show Gist options
  • Save guenin/1855086 to your computer and use it in GitHub Desktop.
Save guenin/1855086 to your computer and use it in GitHub Desktop.
rspec wishes
class Foo
attr_accessor :bar
def initialize(bar)
self.bar = bar
end
end
# what I do now...
describe Foo do
let(:foo) { Foo.new('baz') }
subject { foo }
describe '#bar' do
subject { foo.bar }
it { should == 'baz' }
describe '#size' do
subject { foo.bar.size }
it { should == 3 }
end
end
end
# what I want...
describe Foo do
subject { Foo.new('baz') }
method :bar do
it { should == 'baz' }
method :size do
it { should == 3 }
end
end
end
# does this exist? is there a better way?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment