File: mobile-fu_spec.rb

package info (click to toggle)
ruby-mobile-fu 1.4.0%2Bgithub-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 152 kB
  • sloc: ruby: 206; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 767 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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require_relative 'spec_helper'

describe "Changes to ActionController" do

  let(:controller) { InstanceMethodDummy.new }

  describe "is_tablet_device?" do

    let(:user_agent)      { Object.new }
    let(:expected_result) { Object.new }

    it "should return the result from the tablet module" do
      controller.user_agent = user_agent
      ::MobileFu::Tablet.stubs(:is_a_tablet_device?).with(user_agent).returns expected_result
      controller.is_tablet_device?.must_be_same_as expected_result
    end

  end

end

class InstanceMethodDummy

  include ActionController::MobileFu::InstanceMethods

  attr_accessor :user_agent

  def request
    @request ||= begin
      r = Object.new
      r.stubs(:user_agent).returns user_agent
      r
    end
  end

end