File: response_helpers.rb

package info (click to toggle)
ruby-fission 0.5.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 624 kB
  • sloc: ruby: 4,664; makefile: 10
file content (21 lines) | stat: -rw-r--r-- 591 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module ResponseHelpers
  def stub_response_mock_with(args={})
    args.each_pair do |method, data|
      stub(method).and_return(data)
    end
  end

  def stub_as_successful(data=nil)
    stub_response_mock_with :code => 0,
                            :message => '',
                            :successful? => true,
                            :data => data
  end

  def stub_as_unsuccessful
    stub_response_mock_with :code => 1,
                            :message => 'it blew up',
                            :successful? => false,
                            :data => nil
  end
end