Skip to content

Instantly share code, notes, and snippets.

@puneetpandey
Created May 27, 2015 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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
'someone@example.com'
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: 'someone@example.com', mobile: 12021679918
u.email.should == 'someone@example.com'
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: 'someone@example.com', mobile: 12021679918
expect(u.email).to eq('someone@example.com')
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