draper

    5熱度

    2回答

    我在我的Ticket模型的應用程序中有一些相當複雜的JSON響應,我希望我的TicketDecorator成爲構建這些響應的人。 但是,我已經爲我的系統設置了API,並使用RABL來構建這些JSON響應,所以我想重用我已經創建的模板。 我不知道是否有可能從一個方法內作出內部TicketDecorator一個Rabl的模板,這樣的事情: 這裏是我的Rabl的模板tickets/show.json.r

    3熱度

    1回答

    我收到試圖用Draper測試時,出現以下錯誤: NoMethodError: undefined method 'with_unit' for nil:NilClass 這裏是我的測試代碼: # spec/decorators/food_decorator_spec.rb require 'spec_helper' describe FoodDecorator do befor

    3熱度

    1回答

    對於我的視圖,我有一個rspec測試,在我使用draper抽取某些邏輯之前,它工作正常。該視圖在瀏覽器中呈現正確,但現在測試失敗。 require 'spec_helper' describe "articles/index.html.erb" do before(:each) do assign(:articles, [ stub_model(Article,

    2熱度

    2回答

    我嘗試使用Rspec測試我的視圖。在我看來,我有Draper生成的裝飾器。這個裝飾是由decent_exposure寶石公佈。 創建我的RSpec的測試這樣的: require 'spec_helper' describe "boats/show.html.slim" do let(:boat_decorate) { BoatDecorator.new(get_boat) }

    4熱度

    2回答

    在我的裝飾規格文件的輔助方法目前在我的規格/裝飾/ product_decorator_spec.rb,我有以下幾點: require 'spec_helper' describe ProductDecorator do let(:product) { FactoryGirl.create(:product) } subject do ProductDecora

    3熱度

    1回答

    我使用的RSpec和布店寶石https://github.com/jcasimir/draper 在我的控制器這是一個簡單的動作表演 def show @category = Category.find(params[:id]) @products = ProductDecorator.decorate(@category.products) end 和測試 descri

    0熱度

    1回答

    我正在使用Rails + jQuery-tokeninput執行typeahead搜索並填充「belongs_to」關係。這裏是模型: class Performance < ActiveRecord::Base attr_accessible :composition_tokens belongs_to :composition ... attr_read