Sha256: 16bb9dd02e4f964b8b3d142ddeea366a0e5e2cb907c5bd16e12e4c889ed3763a

Contents?: true

Size: 903 Bytes

Versions: 1

Compression:

Stored size: 903 Bytes

Contents

require 'test_helper'

describe "Buttafly::LegendsController" do 

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

  let(:legend) { create(:legend) }
  let(:mapping) { create(:mapping) }

  describe "GET #new" do 

    before do 
      get :new, mapping_id: mapping.id
    end

    it "must succeed" do 
      assert_response 200
    end

    it "must instantiate a legend from existing mapping" do 
      assert_not_nil assigns(:legend)
      assert_not_nil assigns(:mapping)
      assert_not_nil assigns(:new_record)
    end
  end

  describe "POST #create" do 

    it "must be successful" do
      post :create, legend: {"dummy_tribe"=>{"name"=>"tribe name"}}  
      assert_response 302
    end

    it "must add a new legend" do 

      assert_difference('Buttafly::Legend.count', 1) do
        post :create, legend: {"dummy_tribe"=>{"name"=>"tribe name"}}  
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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