RSpec is testing tool for the Ruby programming language. Born under the banner of Behaviour-Driven Development, it is designed to make Test-Driven Development a productive and enjoyable experience with features like:
a rich command line program (the rspec command)
textual descriptions of examples and groups (rspec-core)
flexible and customizable reporting
extensible expectation language (rspec-expectations)
require 'spec_helper'
describe Hotel do
let(:hotel){Hotel.new("Photel",3,110)}
it "should return countcost of final" do
hotel.name.should be_a String
end
end
创建一个简单的类来通过测试
class Hotel
def initialize(name,rating,price)
@name=name
@rating=rating
@price=price
end
end