Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET from test environment #117

Closed
meydjer opened this issue Nov 1, 2016 · 1 comment
Closed

GET from test environment #117

meydjer opened this issue Nov 1, 2016 · 1 comment

Comments

@meydjer
Copy link

meydjer commented Nov 1, 2016

Using Airborne, how can I use GET to return values from test environment?

For example, I have the following test:

it 'should foo the bar' do
  product = FactoryGirl.create(:product)
  get "/v1/products"
  pp product
  pp body
  expect_status 200
end

The output of product is:

#<Product:0x007f9dfe601078
 id: 847,
 ref: "038-71-8140174268593",
 name: "Adipisci Sqryujdcoefpthnzbvagwlxikm",
 description:
  "Lorem ipsum...",
 created_at: Tue, 01 Nov 2016 15:48:25 UTC +00:00,
 updated_at: Tue, 01 Nov 2016 15:48:25 UTC +00:00>

But the output of body is:

"{\"data\":[]}"

I have rails server running test environment with rails s -e test

If I run rails server with development environment, the body returns all products from dev environment with no problems.

@meydjer
Copy link
Author

meydjer commented Nov 2, 2016

I was running the test with RSpec.describe ProductResource, type: :resource do instead of RSpec.describe 'Products', type: :request do.

@meydjer meydjer closed this as completed Nov 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant