Sha256: cd8129bab73c92e329130b62686705ce4b468cdea1af0f1abbdd6827e6088005
Contents?: true
Size: 901 Bytes
Versions: 11
Compression:
Stored size: 901 Bytes
Contents
# -*- encoding : utf-8 -*- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe SavedSearchesController do include Devise::TestHelpers before(:all) do @one = Search.create @two = Search.create @three = Search.create end before(:each) do @user = User.create! :email => 'test@example.com', :password => 'abcd12345', :password_confirmation => 'abcd12345' sign_in @user end describe "save" do it "should let you save a search" do request.env["HTTP_REFERER"] = "where_i_came_from" session[:history] = [@one.id] post :save, :id => @one.id expect(response).to redirect_to "where_i_came_from" end it "should not let you save a search that isn't in your search history" do session[:history] = [@one.id] expect { post :save, :id => @two.id }.to raise_exception end end end
Version data entries
11 entries across 11 versions & 1 rubygems