Sha256: d1becbbb9a160e45eb82adef23a3c25e90e9fdc5916be3ec59c03ed306fee1bd

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

module ActionView
  module Helpers
    module AssetTagHelper
      STYLESHEETS_DIR = "stylesheets"
    end
  end
end

describe MobileFu::MobilizedStyles do

  before(:each) do
    @view = mock(:ActionView)
    @request = mock(:ActionRequest)
    @view.extend(MobileFu::MobilizedStyles)
    @view.stub!(:request).and_return(@request)
    @request.stub!(:user_agent)
  end

  def ua(str)
    @request.stub!(:user_agent).and_return(str)
  end

  it "will include a mobilized css file if it recognizes a string in the user agent" do
    ua "iphone"
    File.should_receive(:exist?).with("stylesheets/style_iphone.css").and_return(true)
    @view.should_receive(:stylesheet_link_tag_without_mobilization).with("style", "style_iphone")
    @view.stylesheet_link_tag_with_mobilization("style")
  end

  it "includes mobiziled css files whether or not the original call to stylesheet_link_tag used a file extension" do
    ua "blackberry"
    File.should_receive(:exist?).with("stylesheets/style_blackberry.css").and_return(true)
    @view.should_receive(:stylesheet_link_tag_without_mobilization).with("style.css", "style_blackberry")
    @view.stylesheet_link_tag_with_mobilization("style.css")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mobile-fu-0.0.1 spec/mobilized_styles_spec.rb