word_mix 0.1.2
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.
- data/Gemfile +4 -0
- data/Gemfile.lock +24 -0
- data/LICENSE +22 -0
- data/README.md +78 -0
- data/Rakefile +2 -0
- data/answer.txt +8 -0
- data/lib/tasks/word_mix.rake +7 -0
- data/lib/word_mix/railtie.rb +12 -0
- data/lib/word_mix/version.rb +3 -0
- data/lib/word_mix.rb +83 -0
- data/spec/data/amount.txt +9 -0
- data/spec/data/amount_answer.txt +2 -0
- data/spec/data/case_insensitive.txt +87 -0
- data/spec/data/case_insensitive_answer.txt +9 -0
- data/spec/data/no_match.txt +22 -0
- data/spec/data/separator.txt +1 -0
- data/spec/data/separator_answer.txt +2 -0
- data/spec/data/stub.txt +78 -0
- data/spec/data/stub_answer.txt +8 -0
- data/spec/data/wordlist.txt +136275 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/word_mix_spec.rb +59 -0
- data/word_mix.gemspec +19 -0
- metadata +91 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require 'word_mix' # and any other gems you need
|
5
|
+
Dir[File.expand_path('../..',__FILE__) + "spec/data/*"].each {|f| require f}
|
6
|
+
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
|
+
config.filter_run :focus => true
|
10
|
+
config.run_all_when_everything_filtered = true
|
11
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WordMix do
|
4
|
+
|
5
|
+
let(:test_path) { File.expand_path('../..',__FILE__) + "/spec/data/"}
|
6
|
+
let(:stub_path) { test_path + "/stub.txt" }
|
7
|
+
let(:stub_answer) { test_path + "/stub_answer.txt" }
|
8
|
+
|
9
|
+
context "should " do
|
10
|
+
|
11
|
+
before(:each) do
|
12
|
+
ENV["TARGET"] = test_path + example.metadata[:target]
|
13
|
+
ENV["AMOUNT"] = example.metadata[:amount]
|
14
|
+
ENV["SEPARATOR"] = example.metadata[:separator]
|
15
|
+
ENV["CASE_INSENSITIVE"] = example.metadata[:case_insensitive]
|
16
|
+
@build_answer = File.expand_path('../..',__FILE__) + "/answer.txt"
|
17
|
+
system "rm #{@build_answer}"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "build empty file", target: "/no_match.txt" do
|
21
|
+
WordMix.init
|
22
|
+
content = File.read(@build_answer)
|
23
|
+
content.should == "\n"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "use custom separator", target: "/separator.txt", separator: "," do
|
27
|
+
WordMix.init
|
28
|
+
content = File.read(@build_answer)
|
29
|
+
content.should == File.read(test_path + "/separator_answer.txt")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "build a file named answer.txt", target: "/stub.txt" do
|
33
|
+
WordMix.init
|
34
|
+
content = File.read(@build_answer)
|
35
|
+
content.should == File.read(stub_answer)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "detect case insensitive when specified", target: "/case_insensitive.txt", case_insensitive: "true" do
|
39
|
+
WordMix.init
|
40
|
+
content = File.read(@build_answer)
|
41
|
+
content.should == File.read(test_path + "/case_insensitive_answer.txt")
|
42
|
+
end
|
43
|
+
|
44
|
+
it "detect custom amount", target: "/amount.txt", amount: "4" do
|
45
|
+
WordMix.init
|
46
|
+
content = File.read(@build_answer)
|
47
|
+
content.should == File.read(test_path + "/amount_answer.txt")
|
48
|
+
end
|
49
|
+
|
50
|
+
it "use the 6 letters word only one time", target: "/stub.txt" do
|
51
|
+
WordMix.init
|
52
|
+
content = File.read(@build_answer)
|
53
|
+
list = content.split("\n")
|
54
|
+
list.size.should == 8
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
data/word_mix.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/word_mix/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["sparkplug"]
|
6
|
+
gem.email = ["mathieub@4nkh.com"]
|
7
|
+
gem.description = %q{conflicting objectives}
|
8
|
+
gem.summary = %q{word mixing test}
|
9
|
+
gem.homepage = "https://github.com/4nkh/word_mix"
|
10
|
+
|
11
|
+
gem.add_development_dependency "rspec"
|
12
|
+
|
13
|
+
gem.files = `git ls-files`.split($\)
|
14
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
15
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
16
|
+
gem.name = "word_mix"
|
17
|
+
gem.require_paths = ["lib"]
|
18
|
+
gem.version = WordMix::VERSION
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: word_mix
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- sparkplug
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: &70178732166540 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70178732166540
|
25
|
+
description: conflicting objectives
|
26
|
+
email:
|
27
|
+
- mathieub@4nkh.com
|
28
|
+
executables: []
|
29
|
+
extensions: []
|
30
|
+
extra_rdoc_files: []
|
31
|
+
files:
|
32
|
+
- Gemfile
|
33
|
+
- Gemfile.lock
|
34
|
+
- LICENSE
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- answer.txt
|
38
|
+
- lib/tasks/word_mix.rake
|
39
|
+
- lib/word_mix.rb
|
40
|
+
- lib/word_mix/railtie.rb
|
41
|
+
- lib/word_mix/version.rb
|
42
|
+
- spec/data/amount.txt
|
43
|
+
- spec/data/amount_answer.txt
|
44
|
+
- spec/data/case_insensitive.txt
|
45
|
+
- spec/data/case_insensitive_answer.txt
|
46
|
+
- spec/data/no_match.txt
|
47
|
+
- spec/data/separator.txt
|
48
|
+
- spec/data/separator_answer.txt
|
49
|
+
- spec/data/stub.txt
|
50
|
+
- spec/data/stub_answer.txt
|
51
|
+
- spec/data/wordlist.txt
|
52
|
+
- spec/spec_helper.rb
|
53
|
+
- spec/word_mix_spec.rb
|
54
|
+
- word_mix.gemspec
|
55
|
+
homepage: https://github.com/4nkh/word_mix
|
56
|
+
licenses: []
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 1.8.10
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: word mixing test
|
79
|
+
test_files:
|
80
|
+
- spec/data/amount.txt
|
81
|
+
- spec/data/amount_answer.txt
|
82
|
+
- spec/data/case_insensitive.txt
|
83
|
+
- spec/data/case_insensitive_answer.txt
|
84
|
+
- spec/data/no_match.txt
|
85
|
+
- spec/data/separator.txt
|
86
|
+
- spec/data/separator_answer.txt
|
87
|
+
- spec/data/stub.txt
|
88
|
+
- spec/data/stub_answer.txt
|
89
|
+
- spec/data/wordlist.txt
|
90
|
+
- spec/spec_helper.rb
|
91
|
+
- spec/word_mix_spec.rb
|