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

Fix zh-cn.html #183

Merged
merged 4 commits into from Jun 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 21 additions & 22 deletions zh_cn.html
Expand Up @@ -121,10 +121,10 @@ <h1><a name="contexts">使用上下文环境 contexts</a></h1>

<div>
<pre><code class="ruby">it 'has 200 status code if logged in' do
response.should respond_with 200
expect(reponse).to respond_with 200
end
it 'has 401 status code if not logged in' do
response.should respond_with 401
expect(response).to respond_with 401
end
</code></pre>
</div>
Expand Down Expand Up @@ -225,8 +225,8 @@ <h1><a name="single">唯一的测试条件</a></h1>
<p class="correct">good (isolated)</p>

<div>
<pre><code class="ruby">it { should respond_with_content_type(:json) }
it { should assign_to(:resource) }
<pre><code class="ruby">it { is_expected.to respond_with_content_type(:json) }
it { is_expected.to assign_to(:resource) }
</code></pre>
</div>

Expand All @@ -236,8 +236,8 @@ <h1><a name="single">唯一的测试条件</a></h1>

<div>
<pre><code class="ruby">it 'creates a resource' do
response.should respond_with_content_type(:json)
response.should assign_to(:resource)
expect(response).to respond_with_content_type(:json)
expect(response).to assign_to(:resource)
end
</code></pre>
</div>
Expand Down Expand Up @@ -327,16 +327,16 @@ <h1><a name="subject">善用 subject</a></h1>
<p class="wrong">bad</p>

<div>
<pre><code class="ruby">it { assigns('message').should match /it was born in belville/ }
it { assigns('message').creator.should match /topolino/ }
<pre><code class="ruby">it { expect(assigns('message')).to match /it was born in belville/ }
it { expect(assigns('message').creator).to match /topolino/ }
</code></pre>
</div>

<p class="correct">good</p>

<div>
<pre><code class="ruby">subject { assigns('message') }
it { should match /it was born in billville/ }
it { is_expected.to match /it was born in billville/ }
</code></pre>
</div>

Expand All @@ -349,7 +349,7 @@ <h1><a name="subject">善用 subject</a></h1>
<div>
<pre><code class="ruby">subject(:hero) { hero.first }
it "carries a sword" do
hero.equipment.should include "sword"
expect(hero.equipment).to include "sword"
end
</code></pre>
</div>
Expand Down Expand Up @@ -390,7 +390,7 @@ <h1><a name="let">使用 let 和 let!</a></h1>
before { @type = type.find @resource.type_id }

it 'sets the type_id field' do
@resource.type_id.should equal(@type.id)
expect(@resource.type_id).to equal(@type.id)
end
end
</code></pre>
Expand All @@ -404,7 +404,7 @@ <h1><a name="let">使用 let 和 let!</a></h1>
let(:type) { type.find resource.type_id }

it 'sets the type_id field' do
resource.type_id.should equal(type.id)
expect(resource.type_id).to equal(type.id)
end
end
</code></pre>
Expand Down Expand Up @@ -481,7 +481,7 @@ <h1><a name="mock">要不要 mock</a></h1>
<pre><code class="ruby"># 模拟一个没有找到的资源
context "when not found" do
before { resource.stub(:where).with(created_from: params[:id]).and_return(false) }
it { should respond_with 404 }
it { is_expected.to respond_with 404 }
end
</code></pre>
</div>
Expand Down Expand Up @@ -516,7 +516,7 @@ <h1><a name="data">只创建你需要的数据</a></h1>
<pre><code class="ruby">describe "user"
describe ".top" do
before { FactoryGirl.create_list(:user, 3) }
it { User.top(2).should have(2).item }
it { expect(User.top(2)).to have(2).item }
end
end
</code></pre>
Expand Down Expand Up @@ -635,7 +635,7 @@ <h1><a name="sharedexamples">共用的测试</a></h1>

it 'shows all owned resources' do
page.driver.get uri
page.status_code.should be(200)
expect(page.status_code).to be(200)
contains_owned_resource resource
does_not_contain_resource not_owned
end
Expand All @@ -644,9 +644,9 @@ <h1><a name="sharedexamples">共用的测试</a></h1>
describe '?start=:uri' do
it 'shows the next page' do
page.driver.get uri, start: resource.uri
page.status_code.should be(200)
expect(page.status_code).to be(200)
contains_resource resources.first
page.should_not have_content resource.id.to_s
expect(page).to_not have_content resource.id.to_s
end
end
end
Expand Down Expand Up @@ -897,7 +897,7 @@ <h1><a name="http">伪装 HTTP 请求</a></h1>
before { stub_request(:get, uri).to_return(status: 401, body: fixture('401.json')) }
it "gets a not authorized notification" do
page.driver.get uri
page.should have_content 'Access denied'
expect(page).to have_content 'Access denied'
end
end
</code></pre>
Expand All @@ -922,12 +922,11 @@ <h1><a name="http">伪装 HTTP 请求</a></h1>

<article>

<h1><a name="formatter">Useful formatter</a></h1>
<h1><a name="formatter">有用的 formatter</a></h1>

<p>
Use a formatter that can give you useful information about the test suite.
I personally find fuubar really nice. To make it work add the gem and set
fuubar as default formatter in your Guardfile.
你可以使用 formater 来获取测试用例的更多的有用的信息。
我个人认为 fuubar 还不错。如果用的话需要增加 gem 并且在 Guardfile 中设置为默认的 formatter。
</p>

<p class="correct">good</p>
Expand Down