Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 5 commits
  • 21 files changed
  • 0 comments
  • 1 contributor
3  .phrase
... ...
@@ -0,0 +1,3 @@
  1
+{
  2
+  "secret": "rJ42iB4qo9XzmQpLy9b6"
  3
+}
4  Gemfile
@@ -4,6 +4,7 @@ gem 'rails', '3.2.2'
4 4
 gem 'thin', '1.3.1'
5 5
 gem 'bootstrap-sass', '2.0.0'
6 6
 gem 'bcrypt-ruby', '3.0.1'
  7
+gem 'phrase'
7 8
 #gem 'will_paginate', '3.0.3'
8 9
 # Bundle edge Rails instead:
9 10
 # gem 'rails', :git => 'git://github.com/rails/rails.git'
@@ -25,7 +26,8 @@ group :test do
25 26
   gem 'guard-spork', '0.3.2'
26 27
   gem 'spork', '0.9.0'
27 28
   gem 'factory_girl_rails', '1.4.0'
28  
-#   gem 'cucumber-rails', '1.3.0'
  29
+  gem 'cucumber-rails', '1.2.1'
  30
+  gem 'database_cleaner', '0.7.0'
29 31
 end
30 32
 
31 33
 group :development do
19  Gemfile.lock
@@ -54,7 +54,18 @@ GEM
54 54
       coffee-script-source
55 55
       execjs
56 56
     coffee-script-source (1.2.0)
  57
+    cucumber (1.1.9)
  58
+      builder (>= 2.1.2)
  59
+      diff-lcs (>= 1.1.2)
  60
+      gherkin (~> 2.9.0)
  61
+      json (>= 1.4.6)
  62
+      term-ansicolor (>= 1.0.6)
  63
+    cucumber-rails (1.2.1)
  64
+      capybara (>= 1.1.2)
  65
+      cucumber (>= 1.1.3)
  66
+      nokogiri (>= 1.5.0)
57 67
     daemons (1.1.8)
  68
+    database_cleaner (0.7.0)
58 69
     diff-lcs (1.1.3)
59 70
     erubis (2.7.0)
60 71
     eventmachine (0.12.10)
@@ -66,6 +77,8 @@ GEM
66 77
       factory_girl (~> 2.3.0)
67 78
       railties (>= 3.0.0)
68 79
     ffi (1.0.11)
  80
+    gherkin (2.9.3)
  81
+      json (>= 1.4.6)
69 82
     guard (1.0.1)
70 83
       ffi (>= 0.5.0)
71 84
       thor (~> 0.14.6)
@@ -90,6 +103,8 @@ GEM
90 103
     multi_json (1.1.0)
91 104
     nokogiri (1.5.2)
92 105
     pg (0.12.2)
  106
+    phrase (0.0.8)
  107
+      activesupport (~> 3.0)
93 108
     polyglot (0.3.3)
94 109
     rack (1.4.1)
95 110
     rack-cache (1.2)
@@ -148,6 +163,7 @@ GEM
148 163
       rack (~> 1.0)
149 164
       tilt (~> 1.1, != 1.3.0)
150 165
     sqlite3 (1.3.5)
  166
+    term-ansicolor (1.0.7)
151 167
     thin (1.3.1)
152 168
       daemons (>= 1.0.9)
153 169
       eventmachine (>= 0.12.6)
@@ -173,12 +189,15 @@ DEPENDENCIES
173 189
   bootstrap-sass (= 2.0.0)
174 190
   capybara (= 1.1.2)
175 191
   coffee-rails (= 3.2.2)
  192
+  cucumber-rails (= 1.2.1)
  193
+  database_cleaner (= 0.7.0)
176 194
   factory_girl_rails (= 1.4.0)
177 195
   guard-rspec (= 0.5.5)
178 196
   guard-spork (= 0.3.2)
179 197
   jquery-rails (= 2.0.0)
180 198
   libnotify (= 0.5.9)
181 199
   pg (= 0.12.2)
  200
+  phrase
182 201
   rails (= 3.2.2)
183 202
   rb-inotify (= 0.8.8)
184 203
   rspec-rails (= 2.9.0)
7  app/assets/javascripts/application.js
@@ -14,3 +14,10 @@
14 14
 //= require jquery_ujs
15 15
 //= require bootstrap
16 16
 //= require_tree .
  17
+
  18
+  var phrase_auth_token = 'rJ42iB4qo9XzmQpLy9b6';
  19
+  (function() {
  20
+    var phraseapp = document.createElement('script'); phraseapp.type = 'text/javascript'; phraseapp.async = true;
  21
+    phraseapp.src = ['https://', 'phraseapp.com/assets/phrase/0.1/app.js?', new Date().getTime()].join('');
  22
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(phraseapp, s);
  23
+  })();
8  config/cucumber.yml
... ...
@@ -0,0 +1,8 @@
  1
+<%
  2
+rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
  3
+rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
  4
+std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
  5
+%>
  6
+default: <%= std_opts %> features
  7
+wip: --tags @wip:3 --wip features
  8
+rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
5  config/database.yml
@@ -7,8 +7,11 @@ development:
7 7
 # Warning: The database defined as "test" will be erased and
8 8
 # re-generated from your development database when you run "rake".
9 9
 # Do not set this db to the same as development or production.
10  
-test:
  10
+test: &test
11 11
   adapter: sqlite3
12 12
   database: db/test.sqlite3
13 13
   pool: 5
14 14
   timeout: 5000
  15
+
  16
+cucumber:
  17
+  <<: *test
5  config/locales/hu.yml
... ...
@@ -0,0 +1,5 @@
  1
+hu:
  2
+  activerecord:
  3
+    attributes:
  4
+      user:
  5
+        password_digest: "Jelszó"
13  features/sign_in.feature
... ...
@@ -0,0 +1,13 @@
  1
+Feature: Signing in
  2
+  
  3
+  Scenario: Unsuccessful signin
  4
+    Given a user visits the signin page
  5
+    When he submits invalid signin information
  6
+    Then he should see an error message
  7
+  
  8
+  Scenario: Successful signin
  9
+    Given a user visits the signin page
  10
+      And the user has an account
  11
+      And the user submits valid signin information
  12
+    Then he should see his profile page
  13
+      And he should see a signout link
31  features/step_definitions/authentication_steps.rb
... ...
@@ -0,0 +1,31 @@
  1
+Given /^a user visits the signin page$/ do
  2
+  visit signin_path
  3
+end
  4
+
  5
+When /^he submits invalid signin information$/ do
  6
+  click_button "Sign in"
  7
+end
  8
+
  9
+Then /^he should see an error message$/ do
  10
+  page.should have_selector('div.alert.alert-error')
  11
+end
  12
+
  13
+Given /^the user has an account$/ do
  14
+  @user = User.create(name: "Example User", email: "user@example.com",
  15
+                      password: "foobar", password_confirmation: "foobar")
  16
+end
  17
+
  18
+When /^the user submits valid signin information$/ do
  19
+  visit signin_path
  20
+  fill_in "Email",    with: @user.email
  21
+  fill_in "Password", with: @user.password 
  22
+  click_button "Sign in"
  23
+end
  24
+
  25
+Then /^he should see his profile page$/ do
  26
+  page.should have_selector('title', text: @user.name)
  27
+end
  28
+
  29
+Then /^he should see a signout link$/ do
  30
+  page.should have_link('Sign out', href: signout_path)
  31
+end
56  features/support/env.rb
... ...
@@ -0,0 +1,56 @@
  1
+# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
  2
+# It is recommended to regenerate this file in the future when you upgrade to a 
  3
+# newer version of cucumber-rails. Consider adding your own code to a new file 
  4
+# instead of editing this one. Cucumber will automatically load all features/**/*.rb
  5
+# files.
  6
+
  7
+require 'cucumber/rails'
  8
+
  9
+# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
  10
+# order to ease the transition to Capybara we set the default here. If you'd
  11
+# prefer to use XPath just remove this line and adjust any selectors in your
  12
+# steps to use the XPath syntax.
  13
+Capybara.default_selector = :css
  14
+
  15
+# By default, any exception happening in your Rails application will bubble up
  16
+# to Cucumber so that your scenario will fail. This is a different from how 
  17
+# your application behaves in the production environment, where an error page will 
  18
+# be rendered instead.
  19
+#
  20
+# Sometimes we want to override this default behaviour and allow Rails to rescue
  21
+# exceptions and display an error page (just like when the app is running in production).
  22
+# Typical scenarios where you want to do this is when you test your error pages.
  23
+# There are two ways to allow Rails to rescue exceptions:
  24
+#
  25
+# 1) Tag your scenario (or feature) with @allow-rescue
  26
+#
  27
+# 2) Set the value below to true. Beware that doing this globally is not
  28
+# recommended as it will mask a lot of errors for you!
  29
+#
  30
+ActionController::Base.allow_rescue = false
  31
+
  32
+# Remove/comment out the lines below if your app doesn't have a database.
  33
+# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
  34
+begin
  35
+  DatabaseCleaner.strategy = :transaction
  36
+rescue NameError
  37
+  raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
  38
+end
  39
+
  40
+# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
  41
+# See the DatabaseCleaner documentation for details. Example:
  42
+#
  43
+#   Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
  44
+#     DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}
  45
+#   end
  46
+#
  47
+#   Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
  48
+#     DatabaseCleaner.strategy = :transaction
  49
+#   end
  50
+#
  51
+
  52
+# Possible values are :truncation and :transaction
  53
+# The :transaction strategy is faster, but might give you threading problems.
  54
+# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature
  55
+Cucumber::Rails::Database.javascript_strategy = :truncation
  56
+
65  lib/tasks/cucumber.rake
... ...
@@ -0,0 +1,65 @@
  1
+# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
  2
+# It is recommended to regenerate this file in the future when you upgrade to a 
  3
+# newer version of cucumber-rails. Consider adding your own code to a new file 
  4
+# instead of editing this one. Cucumber will automatically load all features/**/*.rb
  5
+# files.
  6
+
  7
+
  8
+unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
  9
+
  10
+vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
  11
+$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
  12
+
  13
+begin
  14
+  require 'cucumber/rake/task'
  15
+
  16
+  namespace :cucumber do
  17
+    Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
  18
+      t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
  19
+      t.fork = true # You may get faster startup if you set this to false
  20
+      t.profile = 'default'
  21
+    end
  22
+
  23
+    Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
  24
+      t.binary = vendored_cucumber_bin
  25
+      t.fork = true # You may get faster startup if you set this to false
  26
+      t.profile = 'wip'
  27
+    end
  28
+
  29
+    Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
  30
+      t.binary = vendored_cucumber_bin
  31
+      t.fork = true # You may get faster startup if you set this to false
  32
+      t.profile = 'rerun'
  33
+    end
  34
+
  35
+    desc 'Run all features'
  36
+    task :all => [:ok, :wip]
  37
+
  38
+    task :statsetup do
  39
+      require 'rails/code_statistics'
  40
+      ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
  41
+      ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
  42
+    end
  43
+  end
  44
+  desc 'Alias for cucumber:ok'
  45
+  task :cucumber => 'cucumber:ok'
  46
+
  47
+  task :default => :cucumber
  48
+
  49
+  task :features => :cucumber do
  50
+    STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
  51
+  end
  52
+
  53
+  # In case we don't have ActiveRecord, append a no-op task that we can depend upon.
  54
+  task 'db:test:prepare' do
  55
+  end
  56
+
  57
+  task :stats => 'cucumber:statsetup'
  58
+rescue LoadError
  59
+  desc 'cucumber rake task not available (cucumber not installed)'
  60
+  task :cucumber do
  61
+    abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
  62
+  end
  63
+end
  64
+
  65
+end
12  phrase/locales/phrase.de.yml
... ...
@@ -0,0 +1,12 @@
  1
+---
  2
+de:
  3
+  activerecord:
  4
+    attributes:
  5
+      user:
  6
+        password_digest: Passwort
  7
+  helpers:
  8
+    label:
  9
+      user:
  10
+        email: ~ 
  11
+        name: ~ 
  12
+        password: ~ 
12  phrase/locales/phrase.en.yml
... ...
@@ -0,0 +1,12 @@
  1
+---
  2
+en:
  3
+  activerecord:
  4
+    attributes:
  5
+      user:
  6
+        password_digest: Password
  7
+  helpers:
  8
+    label:
  9
+      user:
  10
+        email: Email
  11
+        name: ~ 
  12
+        password: Password
12  phrase/locales/phrase.hu.yml
... ...
@@ -0,0 +1,12 @@
  1
+---
  2
+hu:
  3
+  activerecord:
  4
+    attributes:
  5
+      user:
  6
+        password_digest: Jelszó
  7
+  helpers:
  8
+    label:
  9
+      user:
  10
+        email: Email
  11
+        name: Név
  12
+        password: Jelszó
1  phrase/uploads/en.yml-20120404-233347.json
... ...
@@ -0,0 +1 @@
  1
+{"summary":{"created":{"count":1,"keys":[{"content":"Password","placeholders":[],"translation_key":{"name":"activerecord.attributes.user.password_digest"}}]},"already_exists":{},"blacklisted":{}}}
1  phrase/uploads/en.yml-20120404-234442.json
... ...
@@ -0,0 +1 @@
  1
+{"summary":{"created":{"count":0,"keys":[]},"already_exists":{"count":1,"keys":[{"content":"Password","placeholders":[],"translation_key":{"name":"activerecord.attributes.user.password_digest"}}]},"blacklisted":{}}}
1  phrase/uploads/en.yml-20120404-234834.json
... ...
@@ -0,0 +1 @@
  1
+{"summary":{"created":{"count":0,"keys":[]},"already_exists":{"count":1,"keys":[{"content":"Password","placeholders":[],"translation_key":{"name":"activerecord.attributes.user.password_digest"}}]},"blacklisted":{}}}
1  phrase/uploads/hu.yml-20120404-233348.json
... ...
@@ -0,0 +1 @@
  1
+{"summary":{"created":{"count":1,"keys":[{"content":"Jelsz\u00f3","placeholders":[],"translation_key":{"name":"activerecord.attributes.user.password_digest"}}]},"already_exists":{},"blacklisted":{}}}
1  phrase/uploads/hu.yml-20120404-234442.json
... ...
@@ -0,0 +1 @@
  1
+{"summary":{"created":{"count":0,"keys":[]},"already_exists":{"count":1,"keys":[{"content":"Jelsz\u00f3","placeholders":[],"translation_key":{"name":"activerecord.attributes.user.password_digest"}}]},"blacklisted":{}}}
1  phrase/uploads/hu.yml-20120404-234835.json
... ...
@@ -0,0 +1 @@
  1
+{"summary":{"created":{"count":0,"keys":[]},"already_exists":{"count":1,"keys":[{"content":"Jelsz\u00f3","placeholders":[],"translation_key":{"name":"activerecord.attributes.user.password_digest"}}]},"blacklisted":{}}}
10  script/cucumber
... ...
@@ -0,0 +1,10 @@
  1
+#!/usr/bin/env ruby
  2
+
  3
+vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
  4
+if vendored_cucumber_bin
  5
+  load File.expand_path(vendored_cucumber_bin)
  6
+else
  7
+  require 'rubygems' unless ENV['NO_RUBYGEMS']
  8
+  require 'cucumber'
  9
+  load Cucumber::BINARY
  10
+end

No commit comments for this range

Something went wrong with that request. Please try again.