Glad you worked it out. Without knowing which tutorial it's hard to say
what the root cause was for sure. I did see this sample project which has a
`CalendarController` (https://github.com/jasonjoh/o365-tutorial). Looking
at that they expect a form of auth to be set in the request. If it's not
present it redirects. That's another possible reason why the request spec
was redirecting.

On Fri, Dec 30, 2016 at 1:41 AM, <[email protected]> wrote:

> Ok this was solved, weird issue. I used microsoft ruby sample office 365
> project as a starting project, and the post couldn't work. So i made a new
> project and copied my code from ruby sample project to new created project
> and it works.
>
>
> Le jeudi 29 décembre 2016 19:19:55 UTC+1, [email protected] a écrit :
>>
>> 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/6087e3f0-3cd2-4ac9-a082-eb9a85255403%40googlegroups.com
> <https://groups.google.com/d/msgid/rspec/6087e3f0-3cd2-4ac9-a082-eb9a85255403%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAKCESdiBnHEHZoDkBvd%3Dy17VKVXQkM9pM5UB7nZme3RZn1LO4w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to