Sha256: 9e4d3a6ad7a98ae6bc426c17b96c5d475aeb8c2b040ac4a9cb7b2a86e64cdcb6
Contents?: true
Size: 1.01 KB
Versions: 31
Compression:
Stored size: 1.01 KB
Contents
require "rails_helper" module Dorsale describe SmallData::FiltersController, type: :controller do routes { Dorsale::Engine.routes } let(:filters) { {key: "value"} } before(:each) do request.env["HTTP_REFERER"] = "where_i_came_from" end describe "create" do let(:action) {post :create, filters: filters} it "should redirect to refferer" do action expect(response).to redirect_to "where_i_came_from" end it "should redirect to call back url if defined" do post :create, filters: {key: "value"}, back_url: "xxx" expect(response).to redirect_to "xxx" end it "should store the filter in cookie" do action expect(response.cookies["filters"]).to eq(filters.to_json) end it "should merge filters with previous filters" do action post :create, filters: {other_key: "value2"} expect(response.cookies["filters"]).to eq({key: "value", other_key: "value2"}.to_json) end end end end
Version data entries
31 entries across 31 versions & 1 rubygems