Sha256: 8944ae62124e102c5522ebf26ac9481471c4f096d542fcafd6c548c5cc494901
Contents?: true
Size: 1.02 KB
Versions: 34
Compression:
Stored size: 1.02 KB
Contents
require 'rails_helper' # RSpec.configure do |c| # c.infer_base_class_for_anonymous_controllers = false # end describe ApplicationController, type: :controller do controller do def index tabulatr_for Product end def current_user "Han Solo" end end describe "passing locales to Tabulatr::Data" do it "implicitly creates a current_user local if not already present" do request.accept = "application/json" Product.create!(:title => 'bar', :active => true, :price => 10.0) fake_response = double({foo: 'bar'}) expect_any_instance_of(Tabulatr::Data).to receive(:data_for_table).with( {"pagesize"=>"20", "arguments"=>"products:title", "controller"=>"anonymous", "action"=>"index"}, {:locals=>{current_user: "Han Solo"}, controller: controller} ).and_return(fake_response) expect(fake_response).to receive(:to_tabulatr_json).and_return({}) get :index, pagesize: 20, arguments: 'products:title' expect(response.code).to eq '200' end end end
Version data entries
34 entries across 34 versions & 1 rubygems