You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: features/controller_specs/README.md
+23-23Lines changed: 23 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,20 +43,20 @@ To specify outcomes, you can use:
43
43
## Examples
44
44
45
45
```ruby
46
-
RSpec.describe TeamsController do
47
-
describe "GET index" do
48
-
it "assigns @teams" do
49
-
team = Team.create
50
-
get :index
51
-
expect(assigns(:teams)).to eq([team])
52
-
end
53
-
54
-
it "renders the index template" do
55
-
get :index
56
-
expect(response).to render_template("index")
57
-
end
58
-
end
46
+
RSpec.describe TeamsController do
47
+
describe "GET index" do
48
+
it "assigns @teams" do
49
+
team = Team.create
50
+
get :index
51
+
expect(assigns(:teams)).to eq([team])
59
52
end
53
+
54
+
it "renders the index template" do
55
+
get :index
56
+
expect(response).to render_template("index")
57
+
end
58
+
end
59
+
end
60
60
```
61
61
62
62
## Views
@@ -70,15 +70,15 @@ To specify outcomes, you can use:
70
70
We encourage you to use [request specs](./request-specs/request-spec) if you want to set headers in your call. If you still want to use controller specs with custom http headers you can use `request.headers`:
71
71
72
72
```ruby
73
-
require "rails_helper"
74
-
75
-
RSpec.describe TeamsController, type: :controller do
76
-
describe "GET index" do
77
-
it "returns a 200" do
78
-
request.headers["Authorization"] = "foo"
79
-
get :show
80
-
expect(response).to have_http_status(:ok)
81
-
end
82
-
end
73
+
require "rails_helper"
74
+
75
+
RSpec.describe TeamsController, type: :controller do
0 commit comments