realestate-com-au / akamai-rspec

Test your akamai configuration with rspec
24 stars 13 forks source link

add custom headers for the get request and add matcher to support expect(response). #14

Closed xiaoshao closed 8 years ago

xiaoshao commented 8 years ago

because it does not support expect(url, headers).to ..... When I want to add some customer headers, It will be hard.

beegibson commented 8 years ago

I don't see any changes to matchers that will allow them to take additional headers as arguments? I don't think PR will do what you want it to do anymore.

xiaoshao commented 8 years ago

I have tried add matchers in order that we can use it like expect(url, custom_headers).to ........ But the rspec does not support that. I just want to use it as following.

response = AkamaiSpec::Request.get(url, headers)
expect(response).to .......
beegibson commented 8 years ago

You could add more arguments like this: http://stackoverflow.com/questions/16135899/rspec-custom-matcher-with-multiple-arguments

Inside akamai_rspec it would not be nice, but it presents a nicer interface. Pull each argument out in a well named variable to make it clear what they all are in the code, and make it clear when you write about it in the README.

beegibson commented 8 years ago

Thanks, in particular for the extra tests! It's great to get the coverage up. There's some more in depth feedback I want to provide, but I'll need a bit more time to write that - I need to find an example I remember being somewhere else in akamai-rspec :).

xiaoshao commented 8 years ago

@biancaG , plz post it, when you still have some feedback.

zaypen commented 8 years ago

@mmollaverdi really raise a good point, I agree to block the card before your conclusion.

zaypen commented 8 years ago

Ar, after reviewing, I found the matcher expect(url).to be_served_from_origin(origin, custom_headers) is not used for now, I removed them by using 'stub_headers', so it can be reverted to expect(url).to be_served_from_origin origin.