Sha256: 76208b2c30b5c0fa7f33150f1c8b8cc202322c127b1fc375885fe2819c4b5015

Contents?: true

Size: 982 Bytes

Versions: 4

Compression:

Stored size: 982 Bytes

Contents

require 'spec_helper'

describe FamilyGallery::UserTaggingsController do
  let(:user) { create :user }
  let(:picture) { create :picture, user_owner: user }
  let(:user_tagging) { create :user_tagging, picture: picture, user: user }
  let(:valid_params) do
    {
      user_id: user.id,
      position_top: 10,
      position_left: 15
    }
  end

  render_views

  routes { FamilyGallery::Engine.routes }

  before do
    sign_in user
  end

  it '#new' do
    get :new, picture_id: picture.id
    expect(response).to be_success
  end

  it '#create' do
    post :create, picture_id: picture.id, user_tagging: valid_params

    created_tagging = assigns(:user_tagging)
    expect(created_tagging).to be_valid

    expect(response).to redirect_to picture
  end

  it '#destroy' do
    delete :destroy, picture_id: picture.id, id: user_tagging.id

    expect { user_tagging.reload }.to raise_error(ActiveRecord::RecordNotFound)

    expect(response).to redirect_to picture
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
family_gallery-0.0.8 spec/controllers/family_gallery/user_taggings_controller_spec.rb
family_gallery-0.0.7 spec/controllers/family_gallery/user_taggings_controller_spec.rb
family_gallery-0.0.6 spec/controllers/family_gallery/user_taggings_controller_spec.rb
family_gallery-0.0.5 spec/controllers/family_gallery/user_taggings_controller_spec.rb