Commit 48a235e1
Changed files (1)
spec
controllers
spec/controllers/registrations_controller_spec.rb
@@ -4,41 +4,56 @@ describe RegistrationsController do
let(:sut) { RegistrationsController.new }
let(:user){ fake }
- context "when updating a users profile settings not including their password" do
- it "should update their website" do
- sut.stub(:current_user).and_return(user)
-
- payload = {
- :current_password => '',
- :email => 'mo@mokhan.ca',
- :facebook => 'mo',
- :name =>'mo',
- :password => '',
- :password_confirmation => '',
- :twitter => 'mocheen',
- :website => 'http://mokhan.ca/',
+ describe "when updating a users settings not including their password" do
+ before(:each) do
+ @payload = {
+ :user => {
+ :current_password => '',
+ :email => 'mo@mokhan.ca',
+ :facebook => 'mo',
+ :name =>'mo',
+ :password => '',
+ :password_confirmation => '',
+ :twitter => 'mocheen',
+ :website => 'http://mokhan.ca/',
+ :interest_ids => []
+ }
}
+ sut.stub(:current_user).and_return(user)
+ sut.stub(:params).and_return(@payload)
+ sut.stub(:update_without_password).and_return(true)
+ sut.stub(:render).and_return(true)
- user.should have_received(:update_without_password,payload)
+ sut.update
end
-
- it "should not change their password" do
-
+ it "should update their website" do
+ user.should have_received(:update_without_password,@payload[:user])
end
end
- context "when updating a users pasword" do
- it "should update their password" do
+ describe "when updating a users pasword" do
+ before(:each) do
+ @payload = {
+ :user => {
+ :current_password => '',
+ :email => 'mo@mokhan.ca',
+ :facebook => 'mo',
+ :name =>'mo',
+ :password => 'secret',
+ :password_confirmation => 'secret',
+ :twitter => 'mocheen',
+ :website => 'http://mokhan.ca/',
+ :interest_ids => []
+ }
+ }
+ sut.stub(:current_user).and_return(user)
+ sut.stub(:params).and_return(@payload)
+ sut.stub(:update_with_password).and_return(true)
+ sut.stub(:render).and_return(true)
+ sut.update
+ end
+ it "should update their password" do
+ user.should have_received(:update_with_password,@payload[:user])
end
end
end
-
-#HTTP GET /creations/ => creations#index
-#HTTP GET /creations/1 => creations#show
-#HTTP GET /creations/1/edit => creations#edit
-#HTTP PUT /creations/1 => creations#update
-#HTTP POST /creations/ => creations#create
-#HTTP DELETE /creations/1 => creations#destroy
-
-
-