Sha256: 85d4849b5d125c883fe14370d02fbe8a210afa5ea56ca49ab9e18dd76ba79124
Contents?: true
Size: 1.7 KB
Versions: 3
Compression:
Stored size: 1.7 KB
Contents
require File.expand_path("#{File.dirname(__FILE__)}/../spec_helper") module TrueWeb describe Views do describe "#[]" do it "returns an object with a render method, which invokes the given method name" do view = TrueWeb::Views.new(Object.new) mock(view, "true_car_makes") view["true_car_makes"].render end describe "lazily created method" do context "when the presenter file exists" do it "evals the presenter file (which is responsible for adding the method)" do authentication_path = "#{FixtureApp.root_dir}/services/authentication" service = Service.new(authentication_path).init app_instance = Object.new stub(app_instance).services {[service]} stub(app_instance).config {FixtureApp} views = Class.new(TrueWeb::Views).new(app_instance) html = views["/authentication/index.html.ms"].call("param1 value") html.should include("param1 value") doc = Nokogiri::HTML(html) doc.at(".child-div").should be_present end end context "when the presenter file does not exist" do it "lazily creates a method that render the mustache template for the given path" do app_instance = Object.new app_instance.class.send(:define_method, :config) do FixtureApp end views = Class.new(TrueWeb::Views).new(app_instance) views.respond_to?("/user/pagelets/i-dont-exist").should be_false views["/user/pagelets/i-dont-exist"] views.respond_to?("/user/pagelets/i-dont-exist").should be_true end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
true-web-0.1.5 | spec/true-web/views_spec.rb |
true-web-0.1.4 | spec/true-web/views_spec.rb |
true-web-0.1.3 | spec/true-web/views_spec.rb |