Module: RSpectacular::Matchers::Authentication

Defined in:
lib/rspectacular/matchers/authentication.rb

Instance Method Summary collapse

Instance Method Details

#it_should_not_require_authentication_for(*actions) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rspectacular/matchers/authentication.rb', line 19

def it_should_not_require_authentication_for(*actions)
  actions.each do |action_parts|
    method, action, params = action_parts

    params ||= {}
    params.reverse_merge! :id => 1

    it "#{method.upcase} ##{action} should not require login" do
      send(method, action, params)

      response.should_not redirect_to(new_user_session_path)
    end
  end
end

#it_should_require_authentication_for(*actions) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rspectacular/matchers/authentication.rb', line 4

def it_should_require_authentication_for(*actions)
  actions.each do |action_parts|
    method, action, params = action_parts

    params ||= {}
    params.reverse_merge! :id => 1

    it "#{method.upcase} ##{action} should require login" do
      send(method, action, params)

      response.should redirect_to(new_user_session_path)
    end
  end
end