Skip to content

Instantly share code, notes, and snippets.

@puneetpandey
Created May 27, 2015 18:24
Show Gist options
  • Save puneetpandey/2d80fa59456a916ea9a1 to your computer and use it in GitHub Desktop.
Save puneetpandey/2d80fa59456a916ea9a1 to your computer and use it in GitHub Desktop.
require 'spec_helper'
class User
def initialize(args = {}); end
def email
'[email protected]'
end
def mobile
12021679918
end
end
describe User do
describe "#initialize with old should way" do
it "should set the email and mobile for user" do
u = User.new email: '[email protected]', mobile: 12021679918
u.email.should == '[email protected]'
u.mobile.should == 12021679918
end
end
describe "#initialize with new expect way" do
it "expects email and mobile param for user" do
u = User.new email: '[email protected]', mobile: 12021679918
expect(u.email).to eq('[email protected]')
expect(u.mobile).to eq(12021679918)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment