Created
March 5, 2012 16:31
-
-
Save sourcerebels/1979142 to your computer and use it in GitHub Desktop.
BDD > Ruby > RSpec Specification Sample
This file contains hidden or 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
class Test | |
def initialize(value) | |
@value = value | |
end | |
def reverse | |
@value = @value.reverse! | |
end | |
def value | |
@value | |
end | |
end |
This file contains hidden or 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
require "test" | |
describe Test, '#reverse' do | |
it "should reverse a string" do | |
test = Test.new "sourcerebels" | |
test.reverse | |
test.value.should eq("sleberecruos") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment