Skip to content

Commit c7efd27

Browse files
authored
Attempt to run some of these tests that fetch surveys live? (#375)
* Try running this test live on CI * No more cassettes for fetching surveys * Clean up tests more * Update NEWS
1 parent cf1e1d8 commit c7efd27

File tree

9 files changed

+35
-2068
lines changed

9 files changed

+35
-2068
lines changed

NEWS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# qualtRics (development version)
22

3-
- Again hanged how CSV files are extracted from the Qualtrics zip archive, to handle more special characters in survey titles (#355)
3+
- Again changed how CSV files are extracted from the Qualtrics zip archive, to handle more special characters in survey titles (#355)
4+
5+
- Updated tests for latest versions of vcr and webmockr (#374, #375)
46

57
# qualtRics 3.2.1
68

tests/fixtures/extract_colmap.yml

Lines changed: 0 additions & 541 deletions
This file was deleted.

tests/fixtures/fetch_one_qid.yml

Lines changed: 0 additions & 375 deletions
This file was deleted.

tests/fixtures/fetch_survey.yml

Lines changed: 0 additions & 471 deletions
This file was deleted.

tests/fixtures/fetch_survey_custom.yml

Lines changed: 0 additions & 306 deletions
This file was deleted.

tests/fixtures/fetch_survey_exclude.yml

Lines changed: 0 additions & 331 deletions
This file was deleted.

tests/testthat/test-extract-colmap.R

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
test_that("extract_colmap() retrieves an appropriate column map generated within read_survey", {
2-
vcr::use_cassette("extract_colmap", {
3-
x <- fetch_survey("SV_56icaa9YAafpAqx", add_column_map = TRUE)
4-
})
1+
skip_on_cran()
52

3+
test_that("extract_colmap() retrieves an appropriate column map generated within read_survey", {
4+
x <- fetch_survey("SV_56icaa9YAafpAqx", add_column_map = TRUE)
65
cm <- extract_colmap(x)
76

87
expect_s3_class(cm, c("tbl_df", "tbl", "data.frame"))

tests/testthat/test-fetch-survey.R

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
test_that("fetch_survey() returns survey with default params", {
22
skip_on_cran()
33

4-
vcr::use_cassette("fetch_survey", {
5-
x <- fetch_survey("SV_3gbwq8aJgqPwQDP")
6-
})
4+
x <- fetch_survey("SV_3gbwq8aJgqPwQDP")
75

86
expect_s3_class(x, c("spec_tbl_df", "tbl_df", "tbl", "data.frame"))
97
expect_named(
@@ -47,20 +45,17 @@ test_that("fetch_survey() returns survey with default params", {
4745
test_that("fetch_survey() returns survey with custom params", {
4846
skip_on_cran()
4947

50-
vcr::use_cassette("fetch_survey_custom", {
51-
x <-
52-
fetch_survey(
53-
"SV_3gbwq8aJgqPwQDP",
54-
start_date = "2015-01-01",
55-
end_date = "2022-06-02 18:40:53",
56-
unanswer_recode = 999,
57-
limit = 15,
58-
include_questions = c("QID16", "QID17"),
59-
include_metadata = c("StartDate", "EndDate", "ResponseId"),
60-
breakout_sets = FALSE,
61-
col_types = readr::cols(EndDate = readr::col_character())
62-
)
63-
})
48+
x <- fetch_survey(
49+
"SV_3gbwq8aJgqPwQDP",
50+
start_date = "2015-01-01",
51+
end_date = "2022-06-02 18:40:53",
52+
unanswer_recode = 999,
53+
limit = 15,
54+
include_questions = c("QID16", "QID17"),
55+
include_metadata = c("StartDate", "EndDate", "ResponseId"),
56+
breakout_sets = FALSE,
57+
col_types = readr::cols(EndDate = readr::col_character())
58+
)
6459

6560
expect_s3_class(x, c("tbl_df", "tbl", "data.frame"))
6661
expect_equal(nrow(x), 15)
@@ -79,19 +74,16 @@ test_that("fetch_survey() returns survey with custom params", {
7974
test_that("fetch_survey() excludes variable classes when requested", {
8075
skip_on_cran()
8176

82-
vcr::use_cassette("fetch_survey_exclude", {
83-
x <-
84-
fetch_survey(
85-
"SV_3gbwq8aJgqPwQDP",
86-
start_date = "2015-01-01",
87-
end_date = "2022-06-02 18:40:53",
88-
unanswer_recode = 999,
89-
limit = 15,
90-
include_questions = NA,
91-
include_metadata = NA,
92-
breakout_sets = FALSE
93-
)
94-
})
77+
x <- fetch_survey(
78+
"SV_3gbwq8aJgqPwQDP",
79+
start_date = "2015-01-01",
80+
end_date = "2022-06-02 18:40:53",
81+
unanswer_recode = 999,
82+
limit = 15,
83+
include_questions = NA,
84+
include_metadata = NA,
85+
breakout_sets = FALSE
86+
)
9587

9688
expect_s3_class(x, c("tbl_df", "tbl", "data.frame"))
9789
expect_equal(nrow(x), 15)
@@ -102,14 +94,12 @@ test_that("fetch_survey() excludes variable classes when requested", {
10294
test_that("fetch_survey() returns survey with only one QID", {
10395
skip_on_cran()
10496

105-
vcr::use_cassette("fetch_one_qid", {
106-
x <- fetch_survey(
107-
"SV_3gbwq8aJgqPwQDP",
108-
limit = 15,
109-
include_questions = c("QID17"),
110-
breakout_sets = FALSE
111-
)
112-
})
97+
x <- fetch_survey(
98+
"SV_3gbwq8aJgqPwQDP",
99+
limit = 15,
100+
include_questions = c("QID17"),
101+
breakout_sets = FALSE
102+
)
113103

114104
expect_s3_class(x, c("spec_tbl_df", "tbl_df", "tbl", "data.frame"))
115105
expect_equal(nrow(x), 15)

tests/testthat/test-generate-url.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
test_that("all surveys URL", {
1+
test_that("generate survey URLs", {
22
withr::with_envvar(
33
new = c(
44
"QUALTRICS_API_KEY" = "1234",

0 commit comments

Comments
 (0)