yasslab/railstutorial.jp — pull request #10 by changeworld (2014-09-09 13:09:59+00:00)
Title: Fix wrong indent

![2014-09-09 22 06 21](https://cloud.githubusercontent.com/assets/1207985/4201784/251c9cf0-3822-11e4-8f93-8a157e442ca4.png)
||

describe "with valid information" do
before do
fill_in "Name", with: "Example User"
fill_in "Email", with: "user@example.com"
fill_in "Password", with: "foobar"
fill_in "Confirmation", with: "foobar"
end
it "should create a user" do
expect { click_button submit }.to change(User, :count).by(1)
end
describe "after saving the user" do
before { click_button submit }
let(:user) { User.find_by(email: 'user@example.com') }
it { should have_link('Sign out') }
it { should have_title(user.name) }
it { should have_selector('div.alert.alert-success', text: 'Welcome') }
end
describe "followed by signout" do
before { click_link "Sign out" }
it { should have_link('Sign in') }
end
end
end
end

Signinしていない状態なので、signoutがクリックできない＝テストに失敗します。

正しいのは以下のように「describe "after saving the user" do」の下位に、「describe "followed by signout" do」が来る必要があります。

describe "after saving the user" do
before { click_button submit }
let(:user) { User.find_by(email: 'user@example.com') }

it { should have_link('Sign out') }
it { should have_title(user.name) }
it { should have_selector('div.alert.alert-success', text: 'Welcome') }

describe "followed by signout" do
before { click_link "Sign out" }
it { should have_link('Sign in') }
end
end
end
end
end