• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

紙のページがペラっとめくれているところを英語でdog earというのですが(page curlとも言うらしい)、作りたくなってちょっと調べてみました。

GIMPのPage Curlフィルター

GIMP_pagecurl_filter.png

Filters → Distorts → Page Curl で作成:

http://docs.gimp.org/en/plug-in-pagecurl.html

GIMPのツールで作成

GIMP_pagecurl_tool.png

上記のフィルターはあまりオプションがないのでちょっと不満。シンプルなものも探してみました。Path・Rotate・Drop Shadowを使って作成:

Creating a Page Curl & A Simple Website Template.
http://gimpology.com/submission/view/creating_a_page_curl_amp_a_simple_website_template_/

Photoshopでの作成の仕方のhowto

Photoshop_dogear.png

GIMPではないですが、参考になったので挙げておきます:

Dog Ear Tutorial
http://designoahu.com/dog-ear-tutorial

posted by Png satoko on Fri 17 Apr 2009 at 06:51

前の記事のsnippets以外にも参考になった記事を集めておきます。

Scenario, Features, Steps サンプル

Tutorials and Related Blog Posts

@variablesについての議論

http://www.ruby-forum.com/topic/181116

@userなどstep?scenario?にまたがる変数の使い方ですが、極力使わないのがスパゲッティ防止によさそうらしいです。900を超えるシナリオがある中で使ったけど、ポイント押さえて使えば大丈夫だったよというエピソードが出てきました。ただ、シーンに応じて使うのだったらありだろうというのが大方の見方かな。

script/generate feature Article

body:stringなどとfieldも渡すと、それに応じてテーブルデータ等も生成してくれます: http://d.hatena.ne.jp/amacou/20090127/1233058682

Cookieの値が保持されないworkaround

http://stackoverflow.com/questions/681183/how-to-handle-cookies-when-testing-with-webrat

The workaround is use Webrat with Selenium back end. It runs all tests in a separate Firefox window, so cookies or javascript is not a problem. The downside is extra time and resources required to run Firefox and do all the real clicks, rendering etc.

他にもhackishなworkaroundが紹介されていました。

posted by Png satoko on Fri 17 Apr 2009 at 05:09

[追記] 次に書いたScenario, stepのリンク集もどうぞ:
http://blog.s21g.com/articles/1441


Given, When and Thenの基本はわかったんだけど、なんとなくスマートに書けるようになるにはまだ足りない気がする。というので色々snippetとして集めてみました。
(文法的にはもう古い物もあるので注意)

Given, When and Then

基本はここで:
http://wiki.github.com/aslakhellesoy/cucumber/given-when-then

Given -> When -> Then の順にしかこないのかと思ったら、下記にシナリオの途中にあらわれるThenもあった:
http://www.benmabey.com/2008/02/04/rspec-plain-text-stories-webrat-chunky-bacon/

   1    Scenario: A visitor successfully submits a new animal
   2      Given no animal named 'Alligator' exists
   3      When visitor goes to /animals/new
   4      Then visitor should see the Animal submission form
   5      When visitor submits an animal with name: 'Alligator', phylum: 'Chordata', animal class: 'Sauropsida', order: 'Crocodilia', family: 'Alligatoridae', genus: 'Alligator', and lay eggs:  'true'
   6      Then an animal named 'Alligator' should exist

Thenの後にWhenがくるのもありなのかも。

Stepの入れ子

http://wiki.github.com/aslakhellesoy/cucumber/calling-steps-from-step-definitions

   1  Given /^(.*) is logged in$/ do |name|
   2    Given "the user #{name} exists" 
   3    Given "I log in as #{name}" 
   4  end

記事作成のfeature

http://railscasts.com/episodes/155-beginning-with-cucumber

   1    Scenario: Create Valid Article
   2      Given I have no articles
   3      And I am on the list of articles
   4      When I follow "New Article"
   5      And I fill in "Title" with "Spuds"
   6      And I fill in "Content" with "Delicious potato wedges!"
   7      And I press "Create"
   8      Then I should see "New article created."
   9      And I should see "Spuds"
  10      And I should see "Delicious potato wedges!"
  11      And I should have 1 article
  12  
  13  #article_steps
  14  Given /^I have no articles$/ do
  15    Article.delete_all
  16  end

Scenarioは完結に、Stepで細かく

Imperative vs Declarative Scenarios
http://www.benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories/

Scenarioを短くnarrativeに書いて、stepで細かいフォーム入力などを扱う感じに書かれていて一番しっくりきました。

Imperative 命令法/形の
Declarative => narrative 叙述の

   1   Story: Animal Submission
   2    As a Zoologist
   3    I want to add a new animal to the site
   4    So that I can share my animal knowledge with the community
   5  
   6    Scenario: successful submission
   7    Given I'm on the animal creation page
   8    When I add a new animal
   9    Then I should see the page for my newly created animal
  10    And the notice 'Thank you for your animal submission!'

   1  # animal_steps.rb
   2  When "I add a new animal" do
   3    fills_in 'Name', :with => 'Alligator'
   4    selects 'Chordata', :from => 'Phylum'
   5    fills_in 'Animal Class', :with => 'Sauropsida'
   6    fills_in 'Order', :with => 'Crocodilia'
   7    fills_in 'Family', :with => 'Alligatoridae'
   8    fills_in 'Genus', :with => 'Alligator'
   9    checks 'Lay Eggs'
  10    clicks_button 'Create'
  11  end

posted by Png satoko on Fri 17 Apr 2009 at 04:59

最新にしたらpaths.rbとBackgroundが追加されていたのでメモ。

features/support/paths.rb

Cucumberを最新にしてfeatureをgenerateしようとしたらpaths.rbがないと怒られたので、script/generate cucumberでpaths.rbファイルを生成しました。

Scenarioで記述するページはここで定義:

   1  #features/support/paths.rb
   2  module NavigationHelpers
   3    def path_to(page_name)
   4      case page_name
   5      when /the homepage/
   6        root_path         

Background

1feature内のScenarioに共通な前提条件を記述する。
Backgroundで書かれた条件は、各Scenario実行前、かつBefore Hookの後に実行されるようです。

The background is run before each of your scenarios but after any of your Before Hooks.
http://wiki.github.com/aslakhellesoy/cucumber/background

   1    Background:
   2      Given a global administrator named “Greg   3      And a blog named “Greg’s anti-tax rants” 
   4      And a customer named “Dr. Bill   5      And a blog named “Expensive Therapy” owned by “Dr. Bill

posted by Png satoko on Fri 17 Apr 2009 at 04:04
Contents
[GIMP] ページめくり(dog ear, page curl)画像を作る
[Cucumber] Scenario, stepの書き方:リンク集
[Cucumber] Scenario, stepの書き方:snippets
[Cucumber] routes(paths.rb), Background
Comments
KingofSmack: Here also good reads for this mobile applicatio... '14-5
satoko: stackoverflowでも同じエラーを挙げている人がいたので、1.3でアップロードしたよっ... '10-12
ujihisa: :%s/blog/glob/g '10-7
satoko: しゅが〜様 返事が遅くなって申し訳ありません。また、投稿百景ご購入ありがとうございます。 ... '09-10
しゅが~: こんにちは。投稿百景を発売日翌日から利用しています。本当にいいAppを作っていただきました。罫... '09-10
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ