I use RSpec but in a way I would use any xUnit framework. Can this snippet be refactored to look more BDD like (using subject
and stuff)?
describe Time do
describe ".from_sql" do
it "parses date from Vertica" do
actual = Time.from_sql "2012-10-17 12:34:56"
expected = Time.new 2012, 10, 17, 12, 34, 56, 0
actual.should == expected
end
end
describe "#to_js_date" do
it "is converted to JS format" do
t = Time.new 2012, 11, 20
t.to_js_date.should == "2012/11/20"
end
end
end