model_citizen 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/model_citizen/messages.rb +11 -26
- data/lib/model_citizen/version.rb +1 -1
- data/spec/messages_spec.rb +27 -43
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bc4e6c31d7ad4a3e168e3ce96b5e0177ed77e22
|
4
|
+
data.tar.gz: 684aac0117de260f271e1d355d82963c8c437585
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d10dd098d6018d23cbf1db1a7cf94c4a157df4c27f585ca86f5c54396958c0da5c30f75ac241042172fd0331d389ee60bac9bbcf0f24b4c27585062be52bda4
|
7
|
+
data.tar.gz: 76cfe3c7a1b809af2611ee126f8b8d403b0c0477a5a81c8479989c1fc67cdb28043c16a0488c8db30c42ac99edfd6227b39849059eff49938df0eaff5a1ef56d
|
@@ -4,32 +4,17 @@ module ModelCitizen
|
|
4
4
|
attr_reader :messages
|
5
5
|
|
6
6
|
def initialize
|
7
|
-
@messages = {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
"enter_employee_first" => "Please enter employee first name",
|
19
|
-
"enter_employee_last" => "Please enter employee last name",
|
20
|
-
"enter_employee_username" => "Please enter employee username",
|
21
|
-
"enter_employee_type" => "Please enter employee type (admin or non-admin)",
|
22
|
-
"enter_client_name" => "Please enter client name",
|
23
|
-
"enter_client_type" => "Please enter client type (if regular client, please enter 'standard')",
|
24
|
-
"enter_date" => "Please input the project date using this format : YYYY/MM/DD",
|
25
|
-
"future_date_error" => "You cannot log time for the future, please select a different date",
|
26
|
-
"enter_hours" => "Please input hours worked",
|
27
|
-
"log_time" => "Log time",
|
28
|
-
"request_report" => "Request time report",
|
29
|
-
"add_employee" => "Add employee",
|
30
|
-
"add_client" => "Add client",
|
31
|
-
"no_time_to_display" => "No time to display for this month",
|
32
|
-
"request_employee_report" => "Request employee report"}
|
7
|
+
@messages = {
|
8
|
+
:invalid_username => "That is not a valid username, please try again",
|
9
|
+
:invalid_timesheet => "That is not a valid timesheet, please try again",
|
10
|
+
:invalid_client => "That is not a valid client, please try again",
|
11
|
+
:invalid_employee => "That is not a valid employee, please try again",
|
12
|
+
:timesheet_success => "Your timesheet has been successfully saved",
|
13
|
+
:client_success => "Client has been successfully saved",
|
14
|
+
:employee_success => "Employee has been successfully saved",
|
15
|
+
:future_date_error => "You cannot log time for the future, please select a different date",
|
16
|
+
:no_time_to_display => "No time to display for this month",
|
17
|
+
}
|
33
18
|
end
|
34
19
|
|
35
20
|
def get_message(message_choice)
|
data/spec/messages_spec.rb
CHANGED
@@ -2,65 +2,49 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe ModelCitizen::Messages do
|
4
4
|
|
5
|
-
context "displaying messages" do
|
6
|
-
it "should return a prompt to enter username" do
|
7
|
-
type_validator = ModelCitizen::Messages.new.get_message("username_prompt")
|
8
|
-
expect(type_validator).to eq("Please enter your username to get started")
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should return a choose action message" do
|
12
|
-
type_validator = ModelCitizen::Messages.new.get_message("choose_action")
|
13
|
-
expect(type_validator).to eq("Please select what you'd like to do")
|
14
|
-
end
|
5
|
+
context "displaying error messages" do
|
15
6
|
|
16
|
-
it "should return an error
|
17
|
-
type_validator = ModelCitizen::Messages.new.get_message(
|
18
|
-
expect(type_validator).to eq("That is not a valid
|
7
|
+
it "should return an error if username is invalid" do
|
8
|
+
type_validator = ModelCitizen::Messages.new.get_message(:invalid_username)
|
9
|
+
expect(type_validator).to eq("That is not a valid username, please try again")
|
19
10
|
end
|
20
11
|
|
21
|
-
it "should return
|
22
|
-
type_validator = ModelCitizen::Messages.new.get_message(
|
23
|
-
expect(type_validator).to eq("
|
12
|
+
it "should return an error if timesheet is invalid" do
|
13
|
+
type_validator = ModelCitizen::Messages.new.get_message(:invalid_timesheet)
|
14
|
+
expect(type_validator).to eq("That is not a valid timesheet, please try again")
|
24
15
|
end
|
25
16
|
|
26
|
-
it "should return
|
27
|
-
type_validator = ModelCitizen::Messages.new.get_message(
|
28
|
-
expect(type_validator).to eq("
|
17
|
+
it "should return an error if client is invalid" do
|
18
|
+
type_validator = ModelCitizen::Messages.new.get_message(:invalid_client)
|
19
|
+
expect(type_validator).to eq("That is not a valid client, please try again")
|
29
20
|
end
|
30
21
|
|
31
|
-
it "should return
|
32
|
-
type_validator = ModelCitizen::Messages.new.get_message(
|
33
|
-
expect(type_validator).to eq("
|
22
|
+
it "should return an error if employee is invalid" do
|
23
|
+
type_validator = ModelCitizen::Messages.new.get_message(:invalid_employee)
|
24
|
+
expect(type_validator).to eq("That is not a valid employee, please try again")
|
34
25
|
end
|
35
26
|
|
36
|
-
it "should return
|
37
|
-
type_validator = ModelCitizen::Messages.new.get_message(
|
38
|
-
expect(type_validator).to eq("
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should return a prompt to enter client name" do
|
42
|
-
type_validator = ModelCitizen::Messages.new.get_message("enter_client_name")
|
43
|
-
expect(type_validator).to eq("Please enter client name")
|
27
|
+
it "should return an error for logging time in the future" do
|
28
|
+
type_validator = ModelCitizen::Messages.new.get_message(:future_date_error)
|
29
|
+
expect(type_validator).to eq("You cannot log time for the future, please select a different date")
|
44
30
|
end
|
31
|
+
end
|
45
32
|
|
46
|
-
|
47
|
-
type_validator = ModelCitizen::Messages.new.get_message("enter_client_type")
|
48
|
-
expect(type_validator).to eq("Please enter client type (if regular client, please enter 'standard')")
|
49
|
-
end
|
33
|
+
context "displaying success messages" do
|
50
34
|
|
51
|
-
it "should return a
|
52
|
-
type_validator = ModelCitizen::Messages.new.get_message(
|
53
|
-
expect(type_validator).to eq("
|
35
|
+
it "should return a success message if timesheet is valid" do
|
36
|
+
type_validator = ModelCitizen::Messages.new.get_message(:timesheet_success)
|
37
|
+
expect(type_validator).to eq("Your timesheet has been successfully saved")
|
54
38
|
end
|
55
39
|
|
56
|
-
it "should return
|
57
|
-
type_validator = ModelCitizen::Messages.new.get_message(
|
58
|
-
expect(type_validator).to eq("
|
40
|
+
it "should return a success message if client is valid" do
|
41
|
+
type_validator = ModelCitizen::Messages.new.get_message(:client_success)
|
42
|
+
expect(type_validator).to eq("Client has been successfully saved")
|
59
43
|
end
|
60
44
|
|
61
|
-
it "should return a
|
62
|
-
type_validator = ModelCitizen::Messages.new.get_message(
|
63
|
-
expect(type_validator).to eq("
|
45
|
+
it "should return a success message if employee is valid" do
|
46
|
+
type_validator = ModelCitizen::Messages.new.get_message(:employee_success)
|
47
|
+
expect(type_validator).to eq("Employee has been successfully saved")
|
64
48
|
end
|
65
49
|
end
|
66
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: model_citizen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylwia Olak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|