Sha256: 89e04c6bee8d799e14fcdf3e26cc3e0ed5c87edf322e8b56c2ed8492f3df57db

Contents?: true

Size: 1.33 KB

Versions: 7

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe NoFallbackController do
  render_views

  it "should find the correct view when it exists" do
    force_mobile_request_agent
    get :index
    response.should render_template(:index)
    response.body.should contain("MOBILE VIEW")
  end

  it "should find the correct view when it exists" do
    reset_test_request_agent
    get :index
    response.should render_template(:index)
    response.body.should contain("HTML VIEW")
  end

  it "should give an error when there is no mobile view (original format -> html)" do
    force_mobile_request_agent
    was_error = false
    begin
      get(:test)
    rescue ActionView::MissingTemplate => e
      was_error = true
    ensure
      was_error.should be_true
    end
  end

  it "should give an error when there is no mobile view (original format -> html - param)" do
    force_mobile_request_agent
    was_error = false
    begin
      get(:test, :format => :html)
    rescue ActionView::MissingTemplate => e
      was_error = true
    ensure
      was_error.should be_true
    end
  end

  it "should give an error when there is no mobile view (original format -> js)" do
    force_mobile_request_agent
    was_error = false
    begin
      get(:test)
    rescue ActionView::MissingTemplate => e
      was_error = true
    ensure
      was_error.should be_true
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mobylette-1.4.0 spec/controllers/no_fallback_controller_spec.rb
mobylette-1.3.0 spec/controllers/no_fallback_controller_spec.rb
mobylette-1.2.2 spec/controllers/no_fallback_controller_spec.rb
mobylette-1.2.1 spec/controllers/no_fallback_controller_spec.rb
mobylette-1.2.0 spec/controllers/no_fallback_controller_spec.rb
mobylette-1.1.0 spec/controllers/no_fallback_controller_spec.rb
mobylette-1.0.0 spec/controllers/no_fallback_controller_spec.rb