Sha256: e6805b75e21f160f5297b27a979e563de9f7c3b1d3e01a43ceb6fecda1b124e6

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Lolita::RestController do
  render_views
  
  before(:each) do
    @controller.request.env["lolita.mapping"]=Lolita.mappings[:post]
  end

  describe "hooks" do
    it "should call hooks on #index action" do
      @controller.class.class_variable_set(:"@@temp",1)
      @controller.before_index do
        @@temp=2
      end
      get :index
      @controller.class.class_variable_get(:"@@temp").should == 2
    end
  end

  it "should render list component for index action" do
    get :index
    response.should render_template("index")
  end

  it "should overwrite list component body_cell" do
    Factory.create(:post)
    get :index
    response.body.should =~/overwritten cell/
  end

  it "should render tabs for new resource" do
    get :new
    response.body.should =~/select|input/
  end

  it "should change name of field's label to 'bar' if title 'bar' given in fields configuration" do
    tab = Post.lolita.tabs.first
    tab.type.should == :content
    tab.fields.by_name(:title).title = "foobar"
    get :new
    response.body.should =~/foobar/
  end

  it "should display inline error messages if validations fail"

  it "should display all error messages at top of from if a validations fail"

  it "should use field.title instead of field.name when displaying all error messages at top of form"

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lolita-3.1.3 spec/controllers/lolita_rest_spec.rb
lolita-3.1.2 spec/controllers/lolita_rest_spec.rb