aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/info_request_batch_controller_spec.rb
blob: b5075c4e0d9e7fa8daa4a80ec2b2bb67b51cae7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# coding: utf-8
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe InfoRequestBatchController, "when showing a request" do

    before do
        @info_request_batch = FactoryGirl.create(:info_request_batch, :title => 'Matched title',
                                                                      :body => 'Matched body')
        @first_request = FactoryGirl.create(:info_request, :info_request_batch => @info_request_batch)
        @second_request = FactoryGirl.create(:info_request, :info_request_batch => @info_request_batch)
        @default_params = {:id => @info_request_batch.id}
    end

    def make_request(params=@default_params)
        get :show, params
    end

    it 'should be successful' do
        make_request
        response.should be_success
    end

    it 'should assign info_requests to the view' do
        make_request
        assigns[:info_requests].should == [@first_request, @second_request]
    end

    it 'should assign an info_request_batch to the view' do
        make_request
        assigns[:info_request_batch].should == @info_request_batch
    end
end