Sha256: 2f40ca346f8ce240c3e96e7465ed5e30cbfccd2f45f8833f1f470e6d007c4571

Contents?: true

Size: 1.53 KB

Versions: 39

Compression:

Stored size: 1.53 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'
require 'spec/mocks/errors'

describe ActionView::Base, "with RSpec extensions:", :type => :view do 
  
  describe "expect_render" do
    it "should not raise when render has been received" do
      template.expect_render(:partial => "name")
      template.render :partial => "name"
    end
  
    it "should raise when render has NOT been received" do
      template.expect_render(:partial => "name")
      lambda {
        template.verify_rendered
      }.should raise_error
    end
    
    it "should return something (like a normal mock)" do
      template.expect_render(:partial => "name").and_return("Little Johnny")
      result = template.render :partial => "name"
      result.should == "Little Johnny"
    end
  end
  
  describe "stub_render" do
    it "should not raise when stubbing and render has been received" do
      template.stub_render(:partial => "name")
      template.render :partial => "name"
    end
  
    it "should not raise when stubbing and render has NOT been received" do
      template.stub_render(:partial => "name")
    end
  
    it "should not raise when stubbing and render has been received with different options" do
      template.stub_render(:partial => "name")
      template.render :partial => "view_spec/spacer"
    end

    it "should not raise when stubbing and expecting and render has been received" do
      template.stub_render(:partial => "name")
      template.expect_render(:partial => "name")
      template.render(:partial => "name")
    end
  end

end

Version data entries

39 entries across 39 versions & 7 rubygems

Version Path
jcnetdev-rspec-rails-1.1.5 spec/rails/extensions/action_view_base_spec.rb
jnstq-acts_as_sms-0.1.0 test/vendor/plugins/rspec-rails/spec/rails/extensions/action_view_base_spec.rb
jnstq-acts_as_sms-0.1.1 test/vendor/plugins/rspec-rails/spec/rails/extensions/action_view_base_spec.rb
jnstq-acts_as_sms-0.1.3 test/vendor/plugins/rspec-rails/spec/rails/extensions/action_view_base_spec.rb
jnstq-acts_as_sms-0.1.4 test/vendor/plugins/rspec-rails/spec/rails/extensions/action_view_base_spec.rb
jstorimer-deep-test-2.0.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb
jstorimer-deep-test-1.4.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb
jstorimer-deep-test-1.3.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb
jstorimer-deep-test-1.2.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb
jstorimer-deep-test-1.1.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb
jstorimer-deep-test-1.0.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb
jstorimer-deep-test-0.2.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb
jstorimer-deep-test-0.1.0 sample_rails_project/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb
picolena-0.0.99 app_generators/picolena/templates/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb
picolena-0.1.0 rails_plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb
picolena-0.1.1 rails_plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb
picolena-0.1.3 rails_plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb
picolena-0.1.4 rails_plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb
picolena-0.1.2 rails_plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb
picolena-0.1.5 rails_plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb