Sha256: 21d0c5c562390f2d1e373ef860e1faba43b1ec31dc2445fe2da17e8fe04ca17f

Contents?: true

Size: 754 Bytes

Versions: 1

Compression:

Stored size: 754 Bytes

Contents

require 'test_helper'

describe "Buttafly::MappingsController" do 

  before do 
    @routes = Buttafly::Engine.routes
  end    

  let(:originable) { create(:spreadsheet) }
  let(:mapping) { create(:mapping) }

  it "must POST #create" do 
 
    request.env['HTTP_REFERER'] = "/referring/url"
    post :create, mapping: {
      originable_id: originable.id, 
      targetable_model: "DummyChild"
    }
    assert_response 302
    m = originable.mappings.first
    m.targetable_model.must_equal "DummyChild"
  end

  it "must 'DELETE' destroy" do 
    mapping
    request.env['HTTP_REFERER'] = "/referring/url"
    assert_difference('Buttafly::Mapping.count', -1, 'An mapping must be destroyed') do
      delete :destroy, id: mapping
    end
  end  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
buttafly-0.0.1 test/controllers/buttafly/mappings_controller_test.rb