Sha256: e998074fbe43fa2a79afe31c409846092ca48d52c2e424c7812fb8b3757b5563

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

Given(/^I have a (.+) to make$/) do |arg|
  @text = arg
  @file = "#{ENV['HOME']}/.nikki_#{Time.now.strftime("%Y")}"
end

When(/^I try to (save) my entry$/) do |arg|
  arg == "save"
end

When(/^the journal file can't be found$/) do
  FileUtils.rm(@file) if File.exist?(@file)
end

Then(/^a file should be created$/) do
  FileUtils.touch(@file)
end

Then(/^(my journal entry) saved$/) do |arg|
  @entry = arg
  File.open(@file,"a") { |f| f.puts "#{Time.now.strftime("%d")}. #{arg}" }
end

When(/^it's the first of the month$/) do
  @date = Date.new(2014,2,1)
end

Then(/^the name of the month as an H1 header should be appended$/) do
  File.open(@file, "a") { |file| file.puts "#{@date.strftime("%B")}" }
end

Then(/^and my (entry) should be saved$/) do |arg|
  File.open(@file, "a") { |file| file.puts "#{@date.strftime("%d").strip} #{arg}" }
end

When(/^it's not the first of the month$/) do
  @date = Date.new(2014,2,2)
end

Then(/^my (entry) should be appended along with the day of the month$/) do |arg|
  File.open(@file, "a") { |file| file.puts "#{@date.strftime("%d").strip} #{arg}" }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nikki-0.1.0 features/step_definitions/new_entry.steps.rb