diff options
Diffstat (limited to 'spec/factories')
-rw-r--r-- | spec/factories/censor_rules.rb | 32 | ||||
-rw-r--r-- | spec/factories/foi_attchments.rb | 5 | ||||
-rw-r--r-- | spec/factories/holidays.rb | 8 | ||||
-rw-r--r-- | spec/factories/incoming_messages.rb | 11 | ||||
-rw-r--r-- | spec/factories/info_request_events.rb | 12 |
5 files changed, 68 insertions, 0 deletions
diff --git a/spec/factories/censor_rules.rb b/spec/factories/censor_rules.rb new file mode 100644 index 000000000..2c0b2c822 --- /dev/null +++ b/spec/factories/censor_rules.rb @@ -0,0 +1,32 @@ +FactoryGirl.define do + + factory :censor_rule do + text 'some text to redact' + replacement '[REDACTED]' + last_edit_editor 'FactoryGirl' + last_edit_comment 'Modified by rspec' + + factory :regexp_censor_rule do + text '\w+@\w+' + regexp true + end + + factory :info_request_censor_rule do + info_request + end + + factory :public_body_censor_rule do + public_body + end + + factory :user_censor_rule do + user + end + + factory :global_censor_rule do + initialize_with { CensorRule.new(:allow_global => true) } + end + + end + +end diff --git a/spec/factories/foi_attchments.rb b/spec/factories/foi_attchments.rb index 4e9875a00..a1d04ccf0 100644 --- a/spec/factories/foi_attchments.rb +++ b/spec/factories/foi_attchments.rb @@ -16,6 +16,11 @@ FactoryGirl.define do filename 'interesting.rtf' body { load_file_fixture('interesting.rtf') } end + factory :html_attachment do + content_type 'text/html' + filename 'interesting.html' + body { load_file_fixture('interesting.html') } + end end end diff --git a/spec/factories/holidays.rb b/spec/factories/holidays.rb new file mode 100644 index 000000000..531130c8a --- /dev/null +++ b/spec/factories/holidays.rb @@ -0,0 +1,8 @@ +FactoryGirl.define do + + factory :holiday do + day Date.new(2010, 1, 1) + description "New Year's Day" + end + +end diff --git a/spec/factories/incoming_messages.rb b/spec/factories/incoming_messages.rb index 38ad98394..b29fe8ce9 100644 --- a/spec/factories/incoming_messages.rb +++ b/spec/factories/incoming_messages.rb @@ -10,6 +10,9 @@ FactoryGirl.define do FactoryGirl.create(:body_text, :incoming_message => incoming_message, :url_part_number => 1) + + incoming_message.raw_email.incoming_message = incoming_message + incoming_message.raw_email.data = "somedata" end factory :plain_incoming_message do @@ -23,6 +26,14 @@ FactoryGirl.define do end end + factory :incoming_message_with_html_attachment do + after_create do |incoming_message, evaluator| + FactoryGirl.create(:html_attachment, + :incoming_message => incoming_message, + :url_part_number => 2) + end + end + factory :incoming_message_with_attachments do # foi_attachments_count is declared as an ignored attribute and available in # attributes on the factory, as well as the callback via the evaluator diff --git a/spec/factories/info_request_events.rb b/spec/factories/info_request_events.rb new file mode 100644 index 000000000..cdd303ad6 --- /dev/null +++ b/spec/factories/info_request_events.rb @@ -0,0 +1,12 @@ +FactoryGirl.define do + + factory :info_request_event do + info_request + event_type 'response' + params_yaml '' + factory :sent_event do + event_type 'sent' + end + end + +end |