Sha256: 71e54118ded56149d7838e1bbb93805147cf69129cb586b2b8ddf020a6d97dea

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

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

describe Admin::TagsController do
  before do
    request.session = { :user => users(:tobi).id }
  end

  describe 'index action' do
    before :each do
      get :index
    end

    it 'should be success' do
      response.should be_success
    end

    it 'should render template index' do
      response.should render_template('index')
    end

  end


  describe 'edit action' do
    before(:each) do
      @tag_id = contents(:article1).tags.first.id
      get :edit, :id => @tag_id
    end

    it 'should be success' do
      response.should be_success
    end

    it 'should render template edit' do
      response.should render_template('edit')
    end

    it 'should assigns value :tag' do
      assert assigns(:tag).valid?
    end

  end


  describe 'update action' do

    before :each do
      @tag = Tag.find_by_id(contents(:article1).tags.first.id)
      post :edit, 'id' => @tag.id, 'tag' => {:name => 'foobar', :display_name => 'Foo Bar'}
    end

    it 'should redirect to index' do
      response.should redirect_to(:action => 'index')
    end

    it 'should update tag' do
      @tag.reload
      @tag.name.should == 'foobar'
      @tag.display_name == "Foo Bar"
    end

  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
typo-5.4.4 spec/controllers/admin/tags_controller_spec.rb
typo-5.4.3 spec/controllers/admin/tags_controller_spec.rb
typo-5.4.2 spec/controllers/admin/tags_controller_spec.rb
typo-5.4.1 spec/controllers/admin/tags_controller_spec.rb
typo-5.4 spec/controllers/admin/tags_controller_spec.rb