Ruby-on-rails 语法错误,意外的 tIDENTIFIER,期待 keyword_end
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10921969/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
syntax error, unexpected tIDENTIFIER, expecting keyword_end
提问by SilverNightaFall
What am I doing wrong? I think all my ends are right. I am getting this error for
我究竟做错了什么?我认为我所有的目的都是对的。我收到此错误
describe "visiting the edit page" do
describe "submitting to the update action" do
describe "visiting the user index" do
describe "as wrong user" do
FactoryGirl.create(:user, email: "[email protected]")}
and
和
describe "visiting Users#edit page" do
This is the error I am getting when I run rspec
这是我运行 rspec 时遇到的错误
syntax error, unexpected tIDENTIFIER, expecting keyword_end
describe "authorization" do
describe "for non-signed-in users" do
let(:user) {FactoryGirl.create(:user)}
describe "when attempting to visit a protected page" do
before do
visit edit_user_path(user)
fill_in "Email", with: user.email
fill_in "Password", with: user.password
click_button "Sign in"
end
describe "after signing in" do
it "should render the desired protected page" do
page.should have_selector('title', text: 'Edit user')
end
describe "when signing in again" do
before do
click_link "Sign out"
click_link "Sign in"
fill_in "Email", with: user.email
fill_in "Password", with: user.password
click_button "Sign in"
end
it "should render the default (profile) do
page.should have_selector('title', text: user.name)
end
end
end
end
describe "in the Users controller" do
describe "visiting the edit page" do
before {visit edit_user_path(user)}
it { should have_selector('title', text: 'Sign in') }
it {should have_selector('div.alert.alert-notice')}
end
describe "submitting to the update action" do
before { put user_path(user)}
specify {response.should redirect_to(signin_path)}
end
describe "visiting the user index" do
before {visit users_path}
it {should have_selector{'title', text: 'Sign in'}}
end
end
end
describe "as wrong user" do
let(:user) {FactoryGirl.create(:user)}
let(:wrong_user) {FactoryGirl.create(:user, email: "[email protected]")}
before { sign_in user}
describe "visiting Users#edit page" do
before {visit edit_user_path(wrong_user)}
it {should_not have_selector('title', text: 'Edit user')}
end
describe "submitting a PUT request to the Users#update action" do
before {put user_path(wrong_user)}
specify {response.should redirect_to(root_path)}
end
end
end
end
回答by Michael Graff
You are missing a "at the end of it "should render the default (profile) do.
您"在 it "should render the default (profile) do.
回答by mguymon
Right off the bat
立即行动
it "should render the default (profile) do
Is missing the end quote and be should be
缺少结束引号,应该是
it "should render the default (profile)" do
回答by Vladimír Slavík
I had in the podspec this character ” instead of this ".
我在 podspec 中有这个字符“而不是这个”。

