Sha256: 92c9c3dea3d5334bdff6a9053373bbabfb797eae45a20c5211a02b145d2d3087
Contents?: true
Size: 1.48 KB
Versions: 21
Compression:
Stored size: 1.48 KB
Contents
require 'spec_helper' require 'cream/view/host_area' describe Cream::View::Host do extend_view_with Cream::View::Host before do @post = stub(:title => 'my post', :id => 1, :author => 'kristian' ) end describe '#for_localhost' do it "should display localhost guarded content for localhost browser agent" do view_engine do |e, view| view.stubs(:localhost?).returns true res = e.run_template do %{<%= for_localhost do %> hello <% end %> } end res.should match /hello/ end end it "should NOT display localhost guarded content for NON-localhost browser agent" do view_engine do |e, view| view.stubs(:localhost?).returns false res = e.run_template do %{<%= for_localhost { 'hello' } %>} end res.should be_empty end end end describe '#for_public' do it "should display public content for public browser agent" do view_engine do |e, view| view.stubs(:publichost?).returns true res = e.run_template do %{<%= for_public { 'hello' } %>} end res.should match /hello/ end end it "should display public content for public browser agent" do view_engine do |e, view| view.stubs(:publichost?).returns false res = e.run_template do %{<%= for_public { 'hello' } %>} end res.should be_empty end end end end
Version data entries
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
cream-0.7.5 | spec/cream/view/host_area_spec.rb |