Sha256: 15dc0ac208b5d9b4838270731663f3f75326c0ead36d98b990ce80cff80e9c89

Contents?: true

Size: 1.77 KB

Versions: 2

Compression:

Stored size: 1.77 KB

Contents

module Clearance
  module Spec
    module Controllers
      module PasswordsController
        def self.included(base)
          base.class_eval do
            include ActionController::UrlWriter
            
            describe "#create when called for a facebook user" do
              before(:each) do
                @user = stub(:facebook_user? => true, :generate_reset_password_code => nil)
                User.stubs(:find_by_email).returns(@user)
                ClearanceMailer.stubs(:deliver_forgot_password)
              end
              
              it "should assign an error message" do
                @controller.instance_eval{flash.stubs(:sweep)}
                post :create
                flash.now[:error].should be
              end
              
              it "should render the new template" do
                post :create
                response.should render_template('new')
              end
            end
            
            describe "#create when called for a normal user that is unconfirmed" do
              before(:each) do
                @user = stub(:facebook_user? => false, :confirmed? => false, :generate_reset_password_code => nil)
                User.stubs(:find_by_email).returns(@user)
                ClearanceMailer.stubs(:deliver_forgot_password)
              end
              
              it "should assign an error message" do
                @controller.instance_eval{flash.stubs(:sweep)}
                post :create
                flash.now[:error].should be
              end
              
              it "should render the new template" do
                post :create
                response.should render_template('new')
              end
            end
            
          end
        end
      end
    end
  end
end
            

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hashrocket-clearance-0.4.3 lib/clearance/spec/controllers/passwords_controller_spec.rb
hashrocket-clearance-0.4.4 lib/clearance/spec/controllers/passwords_controller_spec.rb