Skip to content

Unable to set headers in before block #86

Closed
@jejacks0n

Description

@jejacks0n

I wanted to use the typical RSpec before filters, so I tagged several of my resources as:

resource_spec.rb

resource "Resource Name", api: :json do
  # specs...
end

spec_helper.rb

RSpec.configure do |config|
  config.before(:each, api: :json) do
    header 'Authorization', "Bearer [access token]"
    header 'Content-Type', 'application/json'
    header 'Accept', 'application/json'
  end
end

It fails on the header, because that's part of the DSL, and doesn't seem to be available any other way. I dug around a good bit, but there doesn't seem to be a way to specify headers/params within a before filter -- which would be nice, because I have to duplicate this at the top of all of the specs.

Thanks for a great library, it's been working really well for me and has been a pleasure to work with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions