Sha256: 959da0dbb9958933698918267496b312cc99c9be0f31a101d7e99b72bd9a6d76

Contents?: true

Size: 1.02 KB

Versions: 12

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

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).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).with "style.css", "style_blackberry"
    @view.stylesheet_link_tag_with_mobilization "style.css"
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
mobile-fu-1.2.2 spec/mobilized_styles_spec.rb
mobile-fu-1.2.1 spec/mobilized_styles_spec.rb
mobile-fu-1.2.0 spec/mobilized_styles_spec.rb
mobile-fu-1.1.1 spec/mobilized_styles_spec.rb
mobile-fu-1.1.0 spec/mobilized_styles_spec.rb
mobile-fu-1.0.0 spec/mobilized_styles_spec.rb
mobile-fu-0.3.0 spec/mobilized_styles_spec.rb
mobile-fu-0.2.1 spec/mobilized_styles_spec.rb
mobile-fu-0.2.0 spec/mobilized_styles_spec.rb
mobile-fu-0.1.2 spec/mobilized_styles_spec.rb
mobile-fu-0.1.1 spec/mobilized_styles_spec.rb
mobile-fu-0.1.0 spec/mobilized_styles_spec.rb