This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scenario: Create a chunk with a single label | |
Given a label exists with timestamp: "17:00:00" | |
And that label is selected | |
When I follow "Nouvel extrait à partir de ce repère" | |
Then I should be on the new chunk page | |
And the "Horaire de début" datetime should contain "17:00:00" | |
And the "Horaire de fin" datetime should contain "17:00:00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Then /^the "([^\"]*)" datetime should contain "([^\"]*)"$/ do |field, value| | |
selected_datetime(:from => field).should == Time.parse(value) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Webrat | |
class Scope | |
def selected_datetime(options = {}) | |
id_prefix = locate_id_prefix(options) do | |
hour_field = FieldByIdLocator.new(@session, dom, /#{select_id("(.*?)",:hour)}$/).locate | |
raise NotFoundError.new("No time fields were found") unless hour_field && hour_field.id =~ /(.*?)_4i/ | |
$1 | |
end | |
time_parts = (1..6).collect do |index| | |
begin | |
field_with_id("#{id_prefix}_#{index}i").value | |
rescue Webrat::NotFoundError | |
nil | |
end | |
end.compact | |
Time.local *time_parts | |
end | |
end | |
end | |
module WebratExtensions | |
def selected_datetime(options = {}) | |
webrat_session.current_scope.selected_datetime(options) | |
end | |
end | |
World(WebratExtensions) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment