Sha256: 174579c88a712a570f6ad9eb5775ee4d1e734da9cbcf3d3d7b287791deaff6c3
Contents?: true
Size: 1 KB
Versions: 3
Compression:
Stored size: 1 KB
Contents
require 'draper' require 'rspec' require 'active_model/naming' require_relative '../app/decorators/post_decorator' Draper::ViewContext.test_strategy :fast Post = Struct.new(:id) { extend ActiveModel::Naming } describe PostDecorator do let(:decorator) { PostDecorator.new(source) } let(:source) { Post.new(42) } it "can use built-in helpers" do expect(decorator.truncated).to eq "Once upon a..." end it "can use built-in private helpers" do expect(decorator.html_escaped).to eq "<script>danger</script>" end it "can't use user-defined helpers from app/helpers" do expect{decorator.hello_world}.to raise_error NoMethodError, /hello_world/ end it "can't use path helpers" do expect{decorator.path_with_model}.to raise_error NoMethodError, /post_path/ end it "can't use url helpers" do expect{decorator.url_with_model}.to raise_error NoMethodError, /post_url/ end it "can't be passed implicitly to url_for" do expect{decorator.link}.to raise_error end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
draper-1.2.0 | spec/dummy/fast_spec/post_decorator_spec.rb |
jamesgolick-draper-1.1.1a | spec/dummy/fast_spec/post_decorator_spec.rb |
draper-1.1.0 | spec/dummy/fast_spec/post_decorator_spec.rb |