Feature: Select dates

  Background: A simple calendar app
    Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support
    And I successfully run `bundle exec rails g scaffold appointment name:string when:datetime`
  
  Scenario: Select dates
    Given I write to "features/create_appointment.feature" with:
      """
      Feature: Create appointments
        Scenario: Constitution on May 17
          Given I am on the new appointment page
          And I fill in "Norway's constitution" for "Name"
          And I select "2009-02-20 15:10:00 UTC" as the "When" date and time
          And I press "Create Appointment"
          Then I should see "Norway's constitution"
          And I should see "2009-02-20 15:10:00 UTC"
      """
    When I run `bundle exec rake db:migrate cucumber`
    Then it should pass with:
      """
      1 scenario (1 passed)
      6 steps (6 passed)
      """
    

Feature: Select dates

  Background: A simple calendar app
    Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support
    And I successfully run `bundle exec rails g scaffold appointment name:string when:datetime`
    And I write to "features/create_appointment.feature" with:
      """
      Feature: Create appointments
        Scenario: Constitution on May 17
          Given I am on the new appointment page
          And I fill in "Norway's constitution" for "Name"
          And I select "2009-02-20 15:10:00 UTC" as the "When" date and time
          And I press "Create Appointment"
          Then I should see "Norway's constitution"
          And I should see "2009-02-20 15:10:00 UTC"
      """
    When I run `bundle exec rake db:migrate cucumber`
  
  Scenario: Select dates
    Then it should pass with:
      """
      1 scenario (1 passed)
      6 steps (6 passed)
      """
  
  Scenario: Select dates with label pointing to first select
    Given I write to "app/views/appointments/_form.html.erb" with:
      """
      <%= form_for(@appointment) do |f| %>
        <div class="field">
          <%= f.label :name %><br />
          <%= f.text_field :name %>
        </div>
        <div class="field">
          <%= f.label :when, :for => "when_li1" %><br />
          <%= f.datetime_select :when %>
        </div>
        <div class="actions">
          <%= f.submit %>
        </div>
      <% end %>
      """
    Then it should pass with:
      """
      1 scenario (1 passed)
      6 steps (6 passed)
      """
Add scenario to cover the case when labels point to the first select element in a datetime select
Add scenario to cover the case when labels point to the first select element in a datetime select