Sha256: a6aa1669df156acbb9f7aa2341e376a1a3df5a7902439580fed62f8edf477a48
Contents?: true
Size: 1.6 KB
Versions: 21
Compression:
Stored size: 1.6 KB
Contents
require 'require_all' require 'spec_helper' require 'cream/helper/host' describe Cream::Helper::Host do extend_view_with Cream::Helper::Host describe '#localhost?' do it "should return true if request.host is 'localhost'" do request = stub() request.stubs(:host).returns 'localhost' view_engine do |e, view| view.stubs(:request).returns request res = e.run_template do %{<%= localhost? %> } end res.should match /true/ end end it "should return true if request.host is '127.0.0.1'" do request = stub() request.stubs(:host).returns '127.0.0.1' view_engine do |e, view| view.stubs(:request).returns request res = e.run_template do %{<%= localhost? %> } end res.should match /true/ end end end describe '#publichost?' do it "should return false if request.host is 'localhost'" do request = stub() request.stubs(:host).returns 'localhost' view_engine do |e, view| view.stubs(:request).returns request res = e.run_template do %{<%= publichost? %> } end res.should match /false/ end end it "should return true if request.host is '214.353.343.222'" do request = stub() request.stubs(:host).returns '214.353.343.222' view_engine do |e, view| view.stubs(:request).returns request res = e.run_template do %{<%= publichost? %> } end res.should match /true/ end end end end
Version data entries
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
cream-0.7.5 | spec/cream/helper/host_spec.rb |