Hello i have two controllers : 

CalendarsController and EventsController

I'm writing a request spec where i try to create an event but before that i 
should create a Calendar to get an id.

So i do in my requests specs : 

RSpec.describe "Event Management", :type => request do 

context "with access token" do
  it "creates a calendar"
    post calendars_create_path, params: {name: "test"}
    expect(response.status).to eq(201)
  end
end

and in the create method of calendars controller i do : 

render json: @data, status: response.status

When i test the same test from above in the Calendars Controller spec it 
works fine and i get the right status code (201)

But in the requests specs it sends back a 307 http redirect code (it triest 
to redirect to GET /calendars/create) for some reasons even tho i have this 
in routes.rb : 

          calendars_index GET      /calendars/index(.:format)           
calendars#index
            calendars_new GET      /calendars/new(.:format)             
calendars#new
         calendars_create POST     /calendars/create(.:format)         
 calendars#create
         calendars_update PATCH    /calendars/update(.:format)         
 calendars#update
        calendars_destroy DELETE   /calendars/destroy(.:format)         
calendars#destroy
           calendars_show GET      /calendars/show(.:format)           
 calendars#show
           calendars_edit GET      /calendars/edit(.:format)           
 calendars#edit
         calendars_delete GET      /calendars/delete(.:format)         
 calendars#delete

so i don't understand why its trying to redirect. Any ideas ?

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/de2b037e-3f70-4989-8cbf-47171e2af697%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to